Skip to content

Commit 28e9add

Browse files
authored
Setup OIDC (#38)
* merge workflows * ensure we match `0.0.0-insiders.<hash>` * bump node versions * add `@types/node`
1 parent 3c3dd3c commit 28e9add

6 files changed

Lines changed: 24 additions & 71 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
strategy:
2020
matrix:
21-
node-version: [14, 16, 18]
21+
node-version: [24]
2222

2323
steps:
2424
- uses: actions/checkout@v3

.github/workflows/prepare-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
strategy:
2323
matrix:
24-
node-version: [14]
24+
node-version: [24]
2525

2626
steps:
2727
- uses: actions/checkout@v3

.github/workflows/release-insiders.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Release
22

33
on:
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"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"@swc/core": "^1.3.7",
4747
"@swc/jest": "^0.2.23",
4848
"@types/jest": "^29.1.2",
49+
"@types/node": "18.8.4",
4950
"jest": "^29.1.2",
5051
"postcss": "^8.4.17",
5152
"prettier": "^2.7.1",

scripts/release-channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
let version =
1111
process.argv[2] || process.env.npm_package_version || require('../package.json').version
1212

13-
let match = /\d+\.\d+\.\d+-(.*)\.\d+/g.exec(version)
13+
let match = /\d+\.\d+\.\d+-(.*)(\.\d+)?/g.exec(version)
1414
if (match) {
1515
console.log(match[1])
1616
} else {

0 commit comments

Comments
 (0)