11name : release-pr
22on :
33 pull_request :
4- types : [opened, reopened, synchronize, labeled]
4+ types : [labeled]
5+
6+ permissions :
7+ contents : read
8+ pull-requests : write
9+
10+ concurrency :
11+ group : ${{ github.workflow }}-${{ github.event.number }}
12+ cancel-in-progress : true
513
614jobs :
715 next-drupal :
816 runs-on : ubuntu-latest
9- if : ${{ contains(github.event.pull_request.labels.*.name, format('release-pr{0} next-drupal', ':')) }}
17+ timeout-minutes : 15
18+ if : |
19+ contains(github.event.pull_request.labels.*.name, format('release-pr{0} next-drupal', ':')) &&
20+ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
1021 environment : Preview
1122 steps :
1223 - name : Init
1324 uses : actions/checkout@v4
1425 with :
1526 ref : ${{ github.event.pull_request.head.sha }}
27+ persist-credentials : false
1628 - name : Setup Node
17- uses : actions/setup-node@v3
29+ uses : actions/setup-node@v4
1830 with :
1931 node-version : 20
32+ registry-url : https://registry.npmjs.org/
2033 - name : Install dependencies
21- run : yarn install
34+ run : yarn install --frozen-lockfile
2235 - name : Determine version
2336 uses : ./.github/version-pr
2437 id : determine-version
@@ -27,18 +40,22 @@ jobs:
2740 - name : Publish to npm
2841 run : |
2942 cd packages/next-drupal
30- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
3143 yarn publish --no-git-checks --access public --tag experimental
3244 env :
33- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
45+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
3446 - name : Comment version on PR
35- uses : NejcZdovc/comment-pr@v2
36- with :
37- message :
38- " 🎉 Experimental release [published 📦️ on npm](https://npmjs.com/package/next-drupal/v/${{ env.VERSION }})!\n \
39- ```sh\n pnpm add next-drupal@${{ env.VERSION }}\n ```\n \
40- ```sh\n yarn add next-drupal@${{ env.VERSION }}\n ```\n \
41- ```sh\n npm i next-drupal@${{ env.VERSION }}\n ```"
4247 env :
4348 VERSION : ${{ steps.determine-version.outputs.version }}
44- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
49+ PR_NUMBER : ${{ github.event.number }}
50+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
51+ run : |
52+ gh pr comment "$PR_NUMBER" --body "🎉 Experimental release [published 📦️ on npm](https://npmjs.com/package/next-drupal/v/$VERSION)!
53+ \`\`\`sh
54+ pnpm add next-drupal@$VERSION
55+ \`\`\`
56+ \`\`\`sh
57+ yarn add next-drupal@$VERSION
58+ \`\`\`
59+ \`\`\`sh
60+ npm i next-drupal@$VERSION
61+ \`\`\`"
0 commit comments