-
Notifications
You must be signed in to change notification settings - Fork 88
109 lines (97 loc) · 4.32 KB
/
Copy pathrelease.yml
File metadata and controls
109 lines (97 loc) · 4.32 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Release
# Triggered automatically when commits land on main, and can also be
# kicked off manually (e.g. to cut a hotfix release on-demand).
on:
push:
branches:
- main
workflow_dispatch:
inputs:
dry_run:
description: 'Run in dry-run mode (no tags or releases created)'
required: false
default: 'false'
type: choice
options:
- 'false'
- 'true'
# Only one release job should run at a time to avoid tag conflicts.
concurrency:
group: release
cancel-in-progress: false
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
# semantic-release needs write access to push tags and create releases.
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Full history is required so semantic-release can read all commits
# and determine the next version correctly.
fetch-depth: 0
# Use a token with write access so the pushed tag triggers downstream
# workflows (the default GITHUB_TOKEN cannot re-trigger workflows).
token: ${{ secrets.GITHUB_TOKEN }}
# ── Node setup ──────────────────────────────────────────────────────────
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
# Cache semantic-release and its plugins so repeat runs are fast.
- name: Cache semantic-release dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-semantic-release-${{ hashFiles('.releaserc.json') }}
restore-keys: |
${{ runner.os }}-semantic-release-
# ── Install release tooling ──────────────────────────────────────────────
# We install globally so no package.json change is needed in the repo root.
- name: Install semantic-release
run: |
npm install -g \
semantic-release@24 \
@semantic-release/changelog@6 \
@semantic-release/git@10 \
@semantic-release/github@10 \
@semantic-release/exec@6 \
conventional-changelog-conventionalcommits@8
# ── Version bump: dashboard ──────────────────────────────────────────────
# The dashboard package.json version is kept in sync via the exec plugin
# (see .releaserc.json prepareCmd). We pre-install deps here so `npm version`
# is available and the package-lock doesn't get regenerated unnecessarily.
- name: Install dashboard dependencies (for version bump)
working-directory: dashboard
run: npm ci
- name: Install listener dependencies (for version bump)
working-directory: listener
run: npm ci --ignore-scripts
# ── Run semantic-release ─────────────────────────────────────────────────
- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }}
run: |
if [ "$DRY_RUN" = "true" ]; then
npx semantic-release --dry-run
else
npx semantic-release
fi
# ── Post-release summary ─────────────────────────────────────────────────
- name: Print release summary
if: always()
run: |
echo "## Release workflow complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
echo "⚠️ Ran in **dry-run** mode — no tag or release was created." >> $GITHUB_STEP_SUMMARY
else
echo "✅ Check the [Releases page](https://github.com/${{ github.repository }}/releases) for the latest release." >> $GITHUB_STEP_SUMMARY
fi