-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (120 loc) · 4.64 KB
/
Copy pathrelease.yml
File metadata and controls
135 lines (120 loc) · 4.64 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: Semver X.Y.Z to publish (tag vX.Y.Z must exist on the remote)
required: true
permissions:
contents: write
env:
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', inputs.version) || github.ref_name }}
RELEASE_VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.ref_name }}
jobs:
release:
# Rolling aliases (v1, v1.0, v1.1) are updated by post-release.mjs — not full releases.
if: >-
github.event_name == 'workflow_dispatch' ||
matches(github.ref_name, '^v[0-9]+\.[0-9]+\.[0-9]+$')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ env.RELEASE_TAG }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: "pnpm"
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Verify package version matches tag
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
TAG_VERSION="${RELEASE_VERSION#v}"
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
echo "Error: package.json version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)"
exit 1
fi
- name: Generate changelog for release
id: changelog
run: |
VERSION="${RELEASE_VERSION#v}"
if [ -f "CHANGELOG.adoc" ]; then
NOTES=$(awk -v v="$VERSION" '
$0 ~ "^== \\[" v "\\]" {flag=1; next}
flag && /^== \[/ {exit}
flag {print}' CHANGELOG.adoc)
if [ -z "$NOTES" ]; then
NOTES="Release v$VERSION"
fi
else
NOTES="Release v$VERSION"
fi
echo "$NOTES" > release_notes.md
- name: Build Antora UI Bundle
run: |
curl -L -o default-ui-bundle.zip https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable
mkdir -p build/ui-bundle
unzip default-ui-bundle.zip -d build/ui-bundle
cp -r supplemental-ui/* build/ui-bundle/
cd build/ui-bundle
zip -r ../../ui-bundle.zip .
cd ../..
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
name: ${{ env.RELEASE_TAG }}
body_path: release_notes.md
files: ui-bundle.zip
overwrite_files: true
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to npm
if: ${{ !contains(env.RELEASE_VERSION, '-') }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pnpm ui-modules:sync
pnpm ui-modules:validate
node -e "const fs=require('fs');const p=JSON.parse(fs.readFileSync('package.json','utf8'));delete p.private;fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n')"
npm publish --access public
npm deprecate antora-dark-theme@* "Renamed — use valentus-theme (bundled dark mode). See https://github.com/antora-supplemental/valentus-theme" || true
- name: Resolve release commit
id: rel
run: echo "sha=$(git rev-list -n 1 "${RELEASE_TAG}")" >> "$GITHUB_OUTPUT"
- name: Update rolling release lines
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.RELEASE_VERSION }}
RELEASE_SHA: ${{ steps.rel.outputs.sha }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: node .github/scripts/post-release.mjs "${VERSION#v}"
- name: Commit supported-lines.json on main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp supported-lines.json /tmp/supported-lines.json
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin main
git checkout main
git pull origin main
cp /tmp/supported-lines.json supported-lines.json
git add supported-lines.json
if git diff --staged --quiet; then
echo "supported-lines.json unchanged"
else
git commit -m "chore: update supported-lines.json for ${RELEASE_TAG}"
git push origin main
fi