Skip to content

Commit 851ac02

Browse files
committed
ci: CI on PRs only, release publishes direct to main [skip ci]
Release now versions + publishes inline on push to main (no version PR): guarded on pending changesets, commits the bump with [skip ci], then `changeset publish` with provenance. CI runs on pull_request only.
1 parent d81c176 commit 851ac02

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: CI
22

33
on:
4-
push:
5-
branches: [main]
64
pull_request:
75

86
jobs:

.github/workflows/release.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Release
33
on:
44
push:
55
branches: [main]
6+
workflow_dispatch:
67

78
concurrency: ${{ github.workflow }}-${{ github.ref }}
89

@@ -11,7 +12,6 @@ jobs:
1112
runs-on: ubuntu-latest
1213
permissions:
1314
contents: write
14-
pull-requests: write
1515
id-token: write
1616
steps:
1717
- uses: actions/checkout@v4
@@ -20,13 +20,23 @@ jobs:
2020
with:
2121
node-version: 22
2222
cache: pnpm
23+
registry-url: https://registry.npmjs.org
2324
- run: pnpm install --frozen-lockfile
24-
- run: pnpm build
25-
- uses: changesets/action@v1
26-
with:
27-
version: pnpm changeset version
28-
publish: pnpm changeset publish
25+
- name: Version and publish
26+
run: |
27+
if [ -z "$(find .changeset -maxdepth 1 -name '*.md' ! -name 'README.md' -print -quit)" ]; then
28+
echo "No changesets present — nothing to release."
29+
exit 0
30+
fi
31+
pnpm build
32+
pnpm changeset version
33+
git config user.name "github-actions[bot]"
34+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
35+
git add -A
36+
git commit -m "chore: release packages [skip ci]"
37+
pnpm changeset publish
38+
git push origin HEAD:main
39+
git push origin --tags
2940
env:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3242
NPM_CONFIG_PROVENANCE: "true"

0 commit comments

Comments
 (0)