Skip to content

Commit f9ab6c2

Browse files
ci: replace push-back publish workflow with tag-driven npm provenance
Adds a CI workflow that runs lint, typecheck, tests and build against Node 20 and 22 on every push and PR. Rewrites publish.yml end to end: - Triggers only on v* tag pushes, no more workflow side-effects. - Bumps actions/checkout and actions/setup-node to v4 and Node 22. - Publishes to npm with --provenance for sigstore attestation. - Drops ad-m/github-push-action; the workflow no longer commits a version bump back to master, which removed a class of permissions and loop hazards. - Drops contributors-readme-action; the credits block in README.md is now plain markdown. - Creates a GitHub release with auto-generated notes after a successful publish, using the tag name as the title.
1 parent 734445f commit f9ab6c2

2 files changed

Lines changed: 88 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
concurrency:
10+
group: ci-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
node: [20, 22]
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node }}
26+
cache: npm
27+
28+
- run: npm ci
29+
30+
- run: npm run build:icons
31+
32+
- run: npm run lint
33+
34+
- run: npm run typecheck
35+
36+
- run: npm test
37+
38+
- run: npm run build
39+
40+
- name: Verify icon count matches feather-icons
41+
run: |
42+
EXPORT_COUNT=$(grep -c '^export' src/icons/index.ts)
43+
echo "Exporting $EXPORT_COUNT icons"
44+
test "$EXPORT_COUNT" -ge 280

.github/workflows/publish.yml

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,57 @@
1-
name: Publish Package
1+
name: Publish to npm
22

33
on:
4-
create:
5-
tags:
6-
- v*
4+
push:
5+
tags: ['v*']
6+
7+
permissions:
8+
contents: write
9+
id-token: write
710

811
jobs:
9-
publish-npm:
12+
publish:
1013
runs-on: ubuntu-latest
14+
environment: npm-publish
1115
steps:
12-
- uses: actions/checkout@v2
13-
with:
14-
persist-credentials: false
15-
fetch-depth: 0
16-
submodules: recursive
17-
- uses: actions/setup-node@v2
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
1819
with:
19-
node-version: 14.x
20+
node-version: 22
2021
registry-url: https://registry.npmjs.org
21-
always-auth: true
22+
cache: npm
23+
24+
- name: Sync package.json version with tag
25+
env:
26+
TAG: ${{ github.ref_name }}
27+
run: |
28+
VERSION="${TAG#v}"
29+
echo "Publishing version $VERSION"
30+
npm version "$VERSION" --no-git-tag-version --allow-same-version
31+
2232
- run: npm ci
23-
- run: npm version "${GITHUB_REF:11}" --no-git-tag-version
24-
- run: npm publish --access public
33+
34+
- run: npm run build:icons
35+
36+
- run: npm run lint
37+
38+
- run: npm run typecheck
39+
40+
- run: npm test
41+
42+
- run: npm run build
43+
44+
- name: Publish to npm
45+
run: npm publish --access public --provenance
2546
env:
2647
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2748

28-
- name: Commit files
29-
run: |
30-
git config --local user.email "yigithanyucedag@gmail.com"
31-
git config --local user.name "yigithanyucedag"
32-
git commit -m "Release: ${GITHUB_REF:11}" -a
33-
- name: Push changes
34-
uses: ad-m/github-push-action@master
35-
with:
36-
github_token: ${{ secrets.GITHUB_TOKEN }}
37-
branch: master
38-
39-
- uses: akhilmhdh/contributors-readme-action@v2.1.2
49+
- name: Create GitHub release
4050
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
TAG: ${{ github.ref_name }}
53+
run: |
54+
gh release create "$TAG" \
55+
--title "$TAG" \
56+
--generate-notes \
57+
--verify-tag

0 commit comments

Comments
 (0)