11name : Release
22
33on :
4+ push :
5+ branches : [main]
46 release :
57 types : [published]
68
@@ -17,10 +19,10 @@ jobs:
1719 node-version : [22]
1820
1921 steps :
20- - uses : actions/checkout@v3
22+ - uses : actions/checkout@v4
2123
2224 - name : Use Node.js ${{ matrix.node-version }}
23- uses : actions/setup-node@v3
25+ uses : actions/setup-node@v4
2426 with :
2527 node-version : ${{ matrix.node-version }}
2628 registry-url : ' https://registry.npmjs.org'
@@ -32,11 +34,20 @@ jobs:
3234 - name : Test
3335 run : npm test
3436
35- - name : Calculate environment variables
37+ - name : Resolve release metadata
3638 run : |
37- echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
39+ if [ "${{ github.event_name }}" = "release" ]; then
40+ echo "RELEASE_KIND=release" >> $GITHUB_ENV
41+ echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
42+ else
43+ echo "RELEASE_KIND=insiders" >> $GITHUB_ENV
44+ echo "INSIDERS_VERSION=0.0.0-insiders.$(git rev-parse --short HEAD)" >> $GITHUB_ENV
45+ echo "RELEASE_CHANNEL=insiders" >> $GITHUB_ENV
46+ fi
47+
48+ - name : Version based on commit
49+ if : env.RELEASE_KIND == 'insiders'
50+ run : npm version "$INSIDERS_VERSION" --force --no-git-tag-version
3851
3952 - name : Publish
40- run : npm publish --provenance --tag ${{ env.RELEASE_CHANNEL }}
41- env :
42- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
53+ run : npm publish --provenance --tag "$RELEASE_CHANNEL"
0 commit comments