11name : Release
22
33on :
4+ push :
5+ branches : [main]
46 release :
57 types : [published]
68
@@ -14,22 +16,17 @@ jobs:
1416
1517 strategy :
1618 matrix :
17- node-version : [14 ]
19+ node-version : [24 ]
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'
27-
28- - name : Use cached node_modules
29- uses : actions/cache@v3
30- with :
31- path : node_modules
32- key : nodeModules-${{ hashFiles('./package-lock.json') }}-${{ matrix.node-version }}
29+ cache : ' npm'
3330
3431 - name : Install dependencies
3532 run : npm install
@@ -40,11 +37,20 @@ jobs:
4037 - name : Test
4138 run : npm test
4239
43- - name : Calculate environment variables
40+ - name : Resolve release metadata
4441 run : |
45- echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
42+ if [ "${{ github.event_name }}" = "release" ]; then
43+ echo "RELEASE_KIND=release" >> $GITHUB_ENV
44+ echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
45+ else
46+ echo "RELEASE_KIND=insiders" >> $GITHUB_ENV
47+ echo "INSIDERS_VERSION=0.0.0-insiders.$(git rev-parse --short HEAD)" >> $GITHUB_ENV
48+ echo "RELEASE_CHANNEL=insiders" >> $GITHUB_ENV
49+ fi
50+
51+ - name : Version based on commit
52+ if : env.RELEASE_KIND == 'insiders'
53+ run : npm version "$INSIDERS_VERSION" --force --no-git-tag-version
4654
4755 - name : Publish
48- run : npm publish --provenance --tag ${{ env.RELEASE_CHANNEL }}
49- env :
50- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
56+ run : npm publish --provenance --tag "$RELEASE_CHANNEL"
0 commit comments