Skip to content

Commit 9896d20

Browse files
feat(trusted-publishing): initial commit to add github actions to support OIDC trusted publishing.
Added github actions: main, check, build and release Added a new channel testing-oidc-trusted-publishing for testing npmjs package deployments
1 parent 97c9125 commit 9896d20

File tree

7 files changed

+170
-3
lines changed

7 files changed

+170
-3
lines changed

.github/workflows/build.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v5
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v6
16+
with:
17+
node-version: '24'
18+
cache: 'npm'
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
# required for browser output-integration tests
24+
- name: Setup Chrome
25+
uses: browser-actions/setup-chrome@v2
26+
with:
27+
install-chromedriver: true
28+
29+
- name: Build
30+
run: npm run build
31+
env:
32+
# required for browser output-integration tests
33+
PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome
34+
35+
- name: Save Build folders
36+
uses: actions/cache/save@v4
37+
with:
38+
path: |
39+
dist
40+
key: build-cache-${{ github.run_id }}-${{ github.run_attempt }}

.github/workflows/check.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
name: Run Checks
3+
4+
on:
5+
workflow_call:
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v5
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v6
17+
with:
18+
node-version: '24'
19+
cache: 'npm'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Restore the build folders
25+
uses: actions/cache/restore@v4
26+
with:
27+
path: |
28+
dist
29+
key: build-cache-${{ github.run_id }}-${{ github.run_attempt }}
30+
31+
- name: Run linter
32+
run: npm run lint
33+
34+
- name: Check prettier formatting
35+
run: npm run prettier:check
36+
37+
- name: Run tests
38+
run: npm test
39+
40+
- name: Test bundle size
41+
run: npm run test:size
42+
43+
- name: Test TypeScript types
44+
run: npm run test:types

.github/workflows/codeql.yml renamed to .github/workflows/codeql.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ jobs:
1919
security-events: write
2020

2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v5
2323

2424
- name: Initialize CodeQL
25-
uses: github/codeql-action/init@v3
25+
uses: github/codeql-action/init@v4
2626
with:
2727
languages: actions
2828

2929
- name: Run CodeQL Analysis
30-
uses: github/codeql-action/analyze@v3
30+
uses: github/codeql-action/analyze@v4
3131
with:
3232
category: actions

.github/workflows/main.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
permissions:
3+
contents: read
4+
5+
on:
6+
push:
7+
branches: ['master', 'next']
8+
pull_request:
9+
branches: ['*']
10+
11+
jobs:
12+
build:
13+
uses: ./.github/workflows/build.yaml
14+
15+
check:
16+
needs: build
17+
uses: ./.github/workflows/check.yaml
18+
19+
release:
20+
# TODO: remove 'testing-oidc-trusted-publishing' branch once trusted publishing is stable
21+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/testing-oidc-trusted-publishing' || github.ref == 'refs/heads/next')
22+
needs: [build, check]
23+
permissions:
24+
contents: write
25+
id-token: write
26+
actions: read
27+
uses: ./.github/workflows/release.yaml

.github/workflows/release.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: release
2+
3+
permissions:
4+
contents: read
5+
# packages: read
6+
7+
on:
8+
workflow_call:
9+
10+
jobs:
11+
release:
12+
name: Release
13+
permissions:
14+
contents: write
15+
# issues: write # Required for creating issues on release failures
16+
id-token: write # Required for OIDC trusted publishing
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v5
21+
# with:
22+
# fetch-depth: 0
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v6
26+
with:
27+
node-version: '24'
28+
registry-url: 'https://registry.npmjs.org'
29+
cache: 'npm'
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Restore the build folders
35+
uses: actions/cache/restore@v4
36+
with:
37+
path: |
38+
dist
39+
key: build-cache-${{ github.run_id }}-${{ github.run_attempt }}
40+
41+
- name: Setup Chrome
42+
uses: browser-actions/setup-chrome@v2
43+
with:
44+
install-chromedriver: true
45+
46+
- name: Run semantic release
47+
run: npm run semantic-release
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
NPM_CONFIG_PROVENANCE: true
51+
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@
159159
"name": "next",
160160
"channel": "next",
161161
"prerelease": true
162+
},
163+
{
164+
"name": "testing-oidc-trusted-publishing",
165+
"channel": "testing-oidc-trusted-publishing",
166+
"prerelease": true
162167
}
163168
],
164169
"plugins": [

0 commit comments

Comments
 (0)