@@ -31,11 +31,20 @@ jobs:
3131 with :
3232 node-version : ' lts/*'
3333 registry-url : ' https://registry.npmjs.org'
34- scope : ' appstore -connect-jwt-generator-cli'
34+ scope : ' aappstore -connect-jwt-generator-cli'
3535 package-manager-cache : false
3636
3737 - name : Can Publish
3838 run : npx can-npm-publish --verbose
39+ working-directory : package
40+
41+ - name : Get package info
42+ id : package
43+ run : |
44+ VERSION=$(jq -r '.version' package.json)
45+ PACKAGE_NAME=$(jq -r '.name' package.json)
46+ echo "version=$VERSION" >> $GITHUB_OUTPUT
47+ echo "name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
3948
4049 - name : Install latest npm
4150 run : |
5261
5362 - name : Build
5463 run : pnpm build
64+ working-directory : package
5565
5666 - name : Publish
5767 run : pnpm -r publish --no-git-checks --access public --provenance
68+ working-directory : package
69+
70+ - name : Create GitHub Release with tag
71+ id : create-release
72+ run : |
73+ RELEASE_URL=$(gh release create "v$VERSION" \
74+ --title "v$VERSION" \
75+ --target "$SHA" \
76+ --notes "$PR_BODY")
77+ echo "url=$RELEASE_URL" >> $GITHUB_OUTPUT
78+ env :
79+ GH_TOKEN : ${{ github.token }}
80+ VERSION : ${{ steps.package.outputs.version }}
81+ SHA : ${{ github.sha }}
82+ PR_BODY : ${{ github.event.pull_request.body }}
83+
84+ - name : Comment on PR - Success
85+ if : |
86+ always() &&
87+ github.event_name == 'pull_request' &&
88+ success()
89+ run : |
90+ gh pr comment "$PR_NUMBER" \
91+ --body "✅ **Release v$VERSION completed successfully!**
92+
93+ - 📦 npm package: https://www.npmjs.com/package/$PACKAGE_NAME/v/$VERSION
94+ - 🏷️ GitHub Release: $RELEASE_URL
95+ - 🔗 Workflow run: $SERVER_URL/$REPOSITORY/actions/runs/$RUN_ID"
96+ env :
97+ GH_TOKEN : ${{ github.token }}
98+ PR_NUMBER : ${{ github.event.pull_request.number }}
99+ VERSION : ${{ steps.package.outputs.version }}
100+ PACKAGE_NAME : ${{ steps.package.outputs.name }}
101+ RELEASE_URL : ${{ steps.create-release.outputs.url }}
102+ SERVER_URL : ${{ github.server_url }}
103+ REPOSITORY : ${{ github.repository }}
104+ RUN_ID : ${{ github.run_id }}
105+
106+ - name : Comment on PR - Failure
107+ if : |
108+ always() &&
109+ github.event_name == 'pull_request' &&
110+ failure()
111+ run : |
112+ gh pr comment "$PR_NUMBER" \
113+ --body "❌ **Release v$VERSION failed**
114+
115+ Please check the workflow logs for details.
116+ 🔗 Workflow run: $SERVER_URL/$REPOSITORY/actions/runs/$RUN_ID"
117+ env :
118+ GH_TOKEN : ${{ github.token }}
119+ PR_NUMBER : ${{ github.event.pull_request.number }}
120+ VERSION : ${{ steps.package.outputs.version }}
121+ SERVER_URL : ${{ github.server_url }}
122+ REPOSITORY : ${{ github.repository }}
123+ RUN_ID : ${{ github.run_id }}
0 commit comments