Skip to content

Commit ca7118b

Browse files
feat(trusted-publishing): add github actions for main, check, build, install_setup
1 parent db981d2 commit ca7118b

File tree

7 files changed

+91
-118
lines changed

7 files changed

+91
-118
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ jobs:
99

1010
steps:
1111
- name: Checkout code
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@v5
1313

1414
- name: Setup Node.js
15-
uses: actions/setup-node@v4
15+
uses: actions/setup-node@v6
1616
with:
17-
node-version: '22'
17+
node-version: '24'
1818
cache: 'npm'
1919

2020
- name: Install dependencies

.github/workflows/check.yaml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- name: Checkout code
13-
uses: actions/checkout@v4
14-
15-
- name: Setup Node.js
16-
uses: actions/setup-node@v4
17-
with:
18-
node-version: '22'
19-
cache: 'npm'
20-
21-
- name: Install dependencies
22-
run: npm ci
23-
2412
- name: Restore the build folders
2513
uses: actions/cache/restore@v4
2614
with:
@@ -31,8 +19,17 @@ jobs:
3119
- name: Run linter
3220
run: npm run lint
3321

22+
- name: Check prettier formatting
23+
run: npm run prettier:check
24+
3425
- name: Check formatting
3526
run: npm run format:check
3627

3728
- name: Run tests
3829
run: npm test
30+
31+
- name: Test bundle size
32+
run: npm run test:size
33+
34+
- name: Test TypeScript types
35+
run: npm run test:types

.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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ on:
1010

1111
jobs:
1212
build:
13+
needs: setup_checkout_install_deps
1314
uses: ./.github/workflows/build.yml
1415

1516
check:
16-
needs: build
17+
needs: [setup_node_checkout_code_and_install_dependencies, build]
1718
uses: ./.github/workflows/check.yml
1819

1920
release:
20-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
21-
needs: [build, check]
21+
# TODO: remove 'testing-oidc-trusted-publishing' branch once trusted publishing is stable
22+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/testing-oidc-trusted-publishing' || github.ref == 'refs/heads/next')
23+
needs: [setup_node_checkout_code_and_install_dependencies, build, check]
2224
permissions:
2325
contents: write
2426
id-token: write

.github/workflows/release.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: release
2+
3+
permissions:
4+
contents: read
5+
packages: read
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
- next
12+
- testing-oidc-trusted-publishing
13+
pull_request:
14+
branches:
15+
- master
16+
17+
jobs:
18+
release:
19+
name: Release
20+
permissions:
21+
packages: write
22+
runs-on: ubuntu-latest
23+
steps:
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: Setup Chrome
32+
uses: browser-actions/setup-chrome@v1
33+
34+
- name: Setup ChromeDriver
35+
uses: browser-actions/setup-chromedriver@v1
36+
37+
- name: Run semantic release
38+
run: npm run semantic-release
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

Lines changed: 0 additions & 97 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Setup node, checkout code and install dependencies"
2+
3+
permissions:
4+
contents: read
5+
packages: read
6+
7+
on:
8+
workflow_call:
9+
10+
jobs:
11+
setup_node_checkout_code_and_install_dependencies:
12+
name: Configure github npm package registry for installing private @contentful packages, any public/non-contentful dependencies will be installed from npmjs.com
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v5
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v6
20+
with:
21+
node-version: '24'
22+
cache: 'npm'
23+
24+
- name: config npmrc
25+
- run: |
26+
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_PACKAGES_READ_TOKEN }}" > ~/.npmrc
27+
echo "@contentful:registry=https://npm.pkg.github.com" >> ~/.npmrc
28+
29+
- name: Install dependencies
30+
run: npm ci

0 commit comments

Comments
 (0)