Skip to content

Commit e7d38fc

Browse files
feat(trusted publishing): initial commit to add release github action to support OIDC trusted publish
1 parent 97c9125 commit e7d38fc

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

.github/workflows/release.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
install_dependencies_and_setup_node_checkout:
19+
name: Configure github npm package registry for installing private @contentful packages, any public/non-contentful dependencies will be installed from npmjs.com
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v5
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v6
27+
with:
28+
node-version: '24'
29+
cache: 'npm'
30+
31+
- name: config npmrc
32+
- run: |
33+
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_PACKAGES_READ_TOKEN }}" > ~/.npmrc
34+
echo "@contentful:registry=https://npm.pkg.github.com" >> ~/.npmrc
35+
36+
- name: Install dependencies
37+
run: npm ci
38+
39+
40+
lint:
41+
name: Lint and Build
42+
runs-on: ubuntu-latest
43+
needs: install_dependencies
44+
steps:
45+
- name: Run linting
46+
run: npm run lint
47+
48+
- name: Check prettier formatting
49+
run: npm run prettier:check
50+
51+
- name: Build project
52+
run: npm run build
53+
54+
- name: Test bundle size
55+
run: npm run test:size
56+
57+
- name: Test TypeScript types
58+
run: npm run test:types
59+
60+
unit:
61+
name: Unit Tests
62+
runs-on: ubuntu-latest
63+
needs: install_dependencies
64+
steps:
65+
- name: Run unit tests
66+
run: npm run test:unit
67+
68+
integration:
69+
name: Integration Tests
70+
runs-on: ubuntu-latest
71+
needs: install_dependencies
72+
steps:
73+
- name: Run integration tests
74+
run: npm run test:integration
75+
76+
release:
77+
name: Release
78+
permissions:
79+
packages: write
80+
runs-on: ubuntu-latest
81+
needs: [lint, unit, integration, install_dependencies]
82+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/next' || github.ref == 'refs/heads/testing-oidc-trusted-publishing')
83+
steps:
84+
- name: Setup Chrome
85+
uses: browser-actions/setup-chrome@v1
86+
87+
- name: Setup ChromeDriver
88+
uses: browser-actions/setup-chromedriver@v1
89+
90+
- name: Build project
91+
run: npm run build
92+
93+
- name: Run semantic release
94+
run: npm run semantic-release
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
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)