Skip to content

Commit da16cca

Browse files
Migrate CI/CD from CircleCI to GitHub Actions with OIDC npm publish (#400)
* Initial plan * Migrate CI/CD to GitHub Actions, bump version to 32.5.0 Agent-Logs-Url: https://github.com/linn/react-components-library/sessions/e904388b-0c3e-47ac-80e4-f1083e00aa3a Co-authored-by: lewisrenfrew <16683709+lewisrenfrew@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: lewisrenfrew <16683709+lewisrenfrew@users.noreply.github.com>
1 parent 5fbff0a commit da16cca

5 files changed

Lines changed: 125 additions & 44 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- '*prerelease*'
8+
9+
permissions:
10+
contents: read
11+
id-token: write
12+
pages: write
13+
14+
jobs:
15+
build-and-test:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
cache: 'npm'
24+
25+
- run: npm ci
26+
27+
- run: npm run build
28+
29+
- run: npm test
30+
31+
publish:
32+
needs: build-and-test
33+
runs-on: ubuntu-latest
34+
if: github.ref == 'refs/heads/main' || contains(github.ref, 'prerelease')
35+
environment: production
36+
permissions:
37+
contents: read
38+
id-token: write
39+
pull-requests: write
40+
steps:
41+
- uses: actions/checkout@v4
42+
with:
43+
fetch-depth: 2
44+
45+
- uses: actions/setup-node@v4
46+
with:
47+
node-version: '20'
48+
registry-url: 'https://registry.npmjs.org'
49+
50+
- run: npm run build
51+
52+
- name: Check if version has changed
53+
id: version-check
54+
run: |
55+
CURRENT=$(node -p "require('./package.json').version")
56+
PREVIOUS=$(git show HEAD~1:package.json | node -p "JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')).version" 2>/dev/null || echo "")
57+
echo "current=$CURRENT" >> "$GITHUB_OUTPUT"
58+
echo "previous=$PREVIOUS" >> "$GITHUB_OUTPUT"
59+
if [ "$CURRENT" != "$PREVIOUS" ]; then
60+
echo "changed=true" >> "$GITHUB_OUTPUT"
61+
else
62+
echo "changed=false" >> "$GITHUB_OUTPUT"
63+
fi
64+
65+
- name: Publish to npm
66+
if: steps.version-check.outputs.changed == 'true'
67+
run: npm publish --provenance
68+
69+
- name: Write step summary (no publish)
70+
if: steps.version-check.outputs.changed == 'false'
71+
run: |
72+
echo "## ℹ️ No npm package published" >> "$GITHUB_STEP_SUMMARY"
73+
echo "" >> "$GITHUB_STEP_SUMMARY"
74+
echo "The version in \`package.json\` (\`${{ steps.version-check.outputs.current }}\`) was not incremented since the previous commit. No package was published to npm." >> "$GITHUB_STEP_SUMMARY"
75+
echo "If you intended to publish a new version, please bump the version number." >> "$GITHUB_STEP_SUMMARY"
76+
77+
- name: Post commit comment (no publish)
78+
if: steps.version-check.outputs.changed == 'false'
79+
uses: actions/github-script@v7
80+
with:
81+
script: |
82+
await github.rest.repos.createCommitComment({
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
commit_sha: context.sha,
86+
body: 'ℹ️ **No npm package published** — the version in `package.json` was not incremented. If you intended to publish a new version, please bump the version number.'
87+
});
88+
89+
deploy-storybook:
90+
needs: build-and-test
91+
runs-on: ubuntu-latest
92+
if: github.ref == 'refs/heads/main'
93+
environment:
94+
name: github-pages
95+
url: ${{ steps.deployment.outputs.page_url }}
96+
permissions:
97+
contents: read
98+
pages: write
99+
id-token: write
100+
concurrency:
101+
group: storybook
102+
cancel-in-progress: false
103+
steps:
104+
- uses: actions/checkout@v4
105+
106+
- uses: actions/setup-node@v4
107+
with:
108+
node-version: '20'
109+
cache: 'npm'
110+
111+
- run: npm ci
112+
113+
- run: npm run build-storybook
114+
115+
- uses: actions/upload-pages-artifact@v3
116+
with:
117+
path: ./storybook-static
118+
119+
- uses: actions/deploy-pages@v4
120+
id: deployment

.github/workflows/deploy-github-pages.yml

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

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Changelog
2+
## [32.5.0] - 2026-04-22
3+
- Migrate CI/CD from CircleCI to GitHub Actions (ci-cd.yml). npm publishing now uses OIDC Trusted Publisher instead of a stored NPM_TOKEN secret, with npm provenance attestation. Storybook deployment consolidated into the same workflow. Publish step now skips gracefully (with a commit comment notification) if the package version has not been incremented.
24
## [32.4.0] - 2026-04-20
35
- Add option to pass hideFromEdit Y/N to Dropdown to support allow obsolete fields to be displayed but not selected.
46
## [32.3.3] - 2026-03-03

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@linn-it/linn-form-components-library",
3-
"version": "32.4.0",
3+
"version": "32.5.0",
44
"private": false,
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.esm.js",

0 commit comments

Comments
 (0)