Skip to content

Commit 7c41433

Browse files
committed
Add GitHub releases
1 parent 334ee9c commit 7c41433

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

.github/workflows/npm-publish.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,45 @@ jobs:
99
publish-npm:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
1316

1417
- run: npm install
1518

1619
- name: Extract version
20+
id: version
1721
run: |
1822
OLD_VERSION=$(npm show @gnosis.pm/safe-react-gateway-sdk version)
1923
NEW_VERSION=$(node -p 'require("./package.json").version')
2024
if [ $NEW_VERSION != $OLD_VERSION ]; then
21-
echo "v$NEW_VERSION" > version.txt
2225
echo "New version $NEW_VERSION detected"
26+
echo "::set-output name=version::v$NEW_VERSION"
27+
git log "v$OLD_VERSION"..HEAD --pretty=format:"* %s" > CHANGELOG.md
2328
else
2429
echo "Version $OLD_VERSION hasn't changed, skipping the release"
30+
exit 1
2531
fi
2632
33+
- name: Publish to NPM
34+
uses: JS-DevTools/npm-publish@v1
35+
with:
36+
token: ${{ secrets.NPM_TOKEN }}
37+
2738
- name: Create a git tag
28-
run: |
29-
if [ -f version.txt ]; then
30-
echo "Creating a git tag"
31-
git tag "$(cat version.txt)"
32-
git push --tags
33-
fi
39+
run: git tag $NEW_VERSION && git push --tags
40+
env:
41+
NEW_VERSION: ${{ steps.version.outputs.version }}
3442

35-
- name: Publish to NPM
43+
- name: GitHub release
44+
uses: actions/create-release@v1
45+
id: create_release
46+
with:
47+
draft: false
48+
prerelease: false
49+
release_name: ${{ steps.version.outputs.version }}
50+
tag_name: ${{ steps.version.outputs.version }}
51+
body_path: CHANGELOG.md
3652
env:
37-
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
38-
run: |
39-
if [ -f version.txt ]; then
40-
echo "Publishing to NPM"
41-
npm publish
42-
fi
53+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)