-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (85 loc) · 3.14 KB
/
Copy pathrelease.yml
File metadata and controls
97 lines (85 loc) · 3.14 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
name: Release
on:
push:
branches:
- main
# Only trigger on changes to files that actually affect what users get
# from `npm install @timothygithinji/t-stack`. Tests, scripts, lint configs,
# docs, the workflow file itself — all excluded; use workflow_dispatch
# if those need to release.
paths:
- "apps/cli/src/**"
- "apps/cli/presets/**"
- "apps/cli/templates/**"
- "packages/**"
- "apps/cli/package.json"
- "package.json"
- "bun.lock"
workflow_dispatch:
inputs:
reason:
description: "Reason for manual release (optional)"
required: false
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write # push tag + release commit back to main
id-token: write # npm trusted publishing (OIDC) + provenance
issues: write
pull-requests: write
steps:
- name: Log manual trigger
if: github.event_name == 'workflow_dispatch'
env:
REASON: ${{ github.event.inputs.reason }}
ACTOR: ${{ github.actor }}
run: |
echo "Manual release triggered by $ACTOR"
[ -n "$REASON" ] && echo "Reason: $REASON" || true
- uses: actions/checkout@v4
with:
fetch-depth: 0 # release-it needs full history for conventional-changelog
token: ${{ secrets.GITHUB_TOKEN }}
- uses: oven-sh/setup-bun@v2
with:
bun-version-file: .bun-version
- name: Set up Node (npm CLI exchanges OIDC for trusted-publishing token)
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Upgrade npm (trusted publishing needs >= 11.5)
run: |
npm install -g npm@11.5.1
npm --version
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# No NPM_TOKEN — npm uses the runner's OIDC token to authenticate
# via the package's trusted publisher.
NPM_CONFIG_PROVENANCE: "true"
run: bun run release --ci
- name: Summary
if: success()
env:
REPO: ${{ github.repository }}
run: |
echo "## Release Summary" >> "$GITHUB_STEP_SUMMARY"
echo "Workflow run for commit \`${GITHUB_SHA::7}\`." >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "- [Releases](https://github.com/$REPO/releases)" >> "$GITHUB_STEP_SUMMARY"
echo "- [npm](https://www.npmjs.com/package/@timothygithinji/t-stack)" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "If no releasable commits since the last tag, release-it exited without bumping. That's expected." >> "$GITHUB_STEP_SUMMARY"