-
-
Notifications
You must be signed in to change notification settings - Fork 19
67 lines (58 loc) · 1.91 KB
/
release.yml
File metadata and controls
67 lines (58 loc) · 1.91 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
name: Semantic Release
on:
push:
branches: [master]
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build and test
run: |
npm run build
npm run test:type-check
npm run test:ci
- name: Build package
run: ./package.sh
- name: Semantic Release (with npm lifecycle)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run release
- name: Commit and push workflow mutations (if any)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail
# Stage docs and common release-mutation files to avoid failing on dirty tree
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A \
package.json \
package-lock.json \
package/package.json \
CHANGELOG.md || true
# If nothing is staged, skip committing to avoid exit 1 from git commit
if git diff --cached --quiet; then
echo "No changes to commit"
exit 0
fi
LAST_TAG=$(git describe --tags --abbrev=0 || echo "latest")
git commit -m "chore(ci): commit workflow mutations (version bumps, lockfile) for ${LAST_TAG} [skip ci]"
git push origin HEAD:${GITHUB_REF_NAME}