-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (62 loc) · 1.97 KB
/
Copy pathrelease.yml
File metadata and controls
74 lines (62 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Release
on:
push:
branches: [main]
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
id-token: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
# Skip the workflow's own version-bump commits to avoid a no-op re-run loop.
if: ${{ !startsWith(github.event.head_commit.message, 'chore(release):') }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: '22.22.1'
registry-url: 'https://registry.npmjs.org'
cache: npm
- name: Upgrade npm for OIDC publish support
run: npm install -g npm@latest
- run: npm ci
- name: Detect pending changesets
id: detect
run: |
shopt -s nullglob
pending=(.changeset/*.md)
has_changes=false
for f in "${pending[@]}"; do
[ "$(basename "$f")" = "README.md" ] && continue
has_changes=true
break
done
echo "has_changes=$has_changes" >> "$GITHUB_OUTPUT"
- name: Bump versions and changelog
if: steps.detect.outputs.has_changes == 'true'
run: npx changeset version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit version bump
if: steps.detect.outputs.has_changes == 'true'
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
git commit -m "chore(release): version packages"
git push
- name: Publish to npm
if: steps.detect.outputs.has_changes == 'true'
run: npm run release
env:
NPM_CONFIG_PROVENANCE: 'true'
- name: Push release tags
if: steps.detect.outputs.has_changes == 'true'
run: git push --tags