@@ -2,25 +2,66 @@ name: Release
22
33on :
44 push :
5- branches :
6- - master
7- - alpha
5+ tags :
6+ - ' v*.*.*'
87
98jobs :
109 release :
1110 name : Release
1211 runs-on : ubuntu-latest
12+ permissions :
13+ contents : write
1314 steps :
1415 - name : Checkout
1516 uses : actions/checkout@v5
17+ with :
18+ fetch-depth : 0
1619 - name : Setup Node.js
1720 uses : actions/setup-node@v5
1821 with :
1922 node-version : 22
23+ registry-url : ' https://registry.npmjs.org'
2024 - name : Install dependencies
2125 run : npm ci
22- - name : Release
26+ - name : Run tests
27+ run : npm run test
28+ - name : Lint
29+ run : npm run lint
30+ - name : Build
31+ run : npm run build
32+ - name : Set version from tag
33+ run : |
34+ VERSION="${GITHUB_REF_NAME#v}"
35+ echo "Setting package.json version to $VERSION"
36+ npm version "$VERSION" --no-git-tag-version --allow-same-version
37+ - name : Publish to npm
38+ run : npm publish --access public
2339 env :
24- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
25- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
26- run : npx semantic-release
40+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
41+ - name : Generate changelog
42+ id : changelog
43+ run : |
44+ PREV_TAG=$(git describe --tags --abbrev=0 "${GITHUB_REF_NAME}^" 2>/dev/null || echo "")
45+ if [ -z "$PREV_TAG" ]; then
46+ COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges)
47+ else
48+ COMMITS=$(git log "$PREV_TAG..${GITHUB_REF_NAME}" --pretty=format:"- %s (%h)" --no-merges)
49+ fi
50+ {
51+ echo "changelog<<__END__"
52+ echo "$COMMITS"
53+ echo "__END__"
54+ } >> "$GITHUB_OUTPUT"
55+ - name : Create GitHub Release
56+ uses : softprops/action-gh-release@v2
57+ with :
58+ tag_name : ${{ github.ref_name }}
59+ name : ${{ github.ref_name }}
60+ body : |
61+ ## What's Changed
62+
63+ ${{ steps.changelog.outputs.changelog }}
64+
65+ **Full Changelog**: https://github.com/sid88in/serverless-appsync-plugin/compare/${{ github.ref_name }}
66+ draft : false
67+ prerelease : false
0 commit comments