-
-
Notifications
You must be signed in to change notification settings - Fork 152
159 lines (151 loc) · 5.52 KB
/
Copy pathrelease.yml
File metadata and controls
159 lines (151 loc) · 5.52 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Release
run-name: Release ${{ inputs.version }} from ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g. 4.0.5 or 4.1.0-alpha.1)'
required: true
type: string
permissions:
contents: write # push the release commit and tag, create the release, publish the docs
id-token: write # npm provenance (OIDC)
jobs:
tag:
name: Bump version and tag
if: (github.ref_name == 'main' || endsWith(github.ref_name, '.x')) && github.repository_owner == 'asciidoctor'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Bump version and update changelog
run: |
node tasks/version.js ${{ inputs.version }}
node tasks/changelog.js release ${{ inputs.version }}
- name: Commit, tag and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -a -m "${{ inputs.version }}"
git tag v${{ inputs.version }} -m "${{ inputs.version }}"
git push origin ${{ github.ref_name }} v${{ inputs.version }}
build:
needs: tag
uses: ./.github/workflows/build.yml
with:
ref: v${{ inputs.version }}
publish:
name: Publish to npmjs
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: v${{ inputs.version }}
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Build core
run: npm run build --prefix packages/core
- name: Publish
run: node tasks/publish.js
- name: Make sure that @asciidoctor/core has been published on npmjs
run: timeout 60s ./scripts/wait-asciidoctor-core-published.sh
release:
name: Publish GitHub release
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: v${{ inputs.version }}
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Generate release notes
run: node tasks/changelog.js notes ${{ inputs.version }} > RELEASE_NOTES.md
- name: Download native image artifacts
uses: actions/download-artifact@v8
with:
pattern: native-image-*
path: packages/asciidoctor/dist
merge-multiple: true
# A release from a maintenance branch must not steal the "Latest" badge
# from the release of the current line (gh marks the newest release as
# latest by default).
- name: Create release and upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ inputs.version }}" \
--title "v${{ inputs.version }}" \
--notes-file RELEASE_NOTES.md \
${{ github.ref_name != 'main' && '--latest=false' || '' }} \
packages/asciidoctor/dist/asciidoctor-linux-arm64 \
packages/asciidoctor/dist/asciidoctor-linux-amd64 \
packages/asciidoctor/dist/asciidoctor-darwin-arm64 \
packages/asciidoctor/dist/asciidoctor-win-amd64.exe
- name: Announcement
uses: zulip/github-actions-zulip/send-message@v1
with:
email: ${{ secrets.ZULIP_USERNAME }}
api-key: ${{ secrets.ZULIP_API_KEY }}
organization-url: 'https://asciidoctor.zulipchat.com'
to: '279652'
type: 'stream'
topic: 'releases'
content: |
Asciidoctor.js v${{ inputs.version }} is out!
https://github.com/asciidoctor/asciidoctor.js/releases/tag/v${{ inputs.version }}
docs:
name: Publish API documentation
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: v${{ inputs.version }}
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Generate API documentation
run: |
npm run docs --prefix packages/core
npm run docs --prefix packages/asciidoctor
cp -r packages/asciidoctor/build/docs packages/core/build/docs/cli
- name: Compute docs destination folder
id: dest
run: |
VERSION="${{ inputs.version }}"
if [[ "$VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-(alpha|beta|rc)\. ]]; then
echo "folder=${BASH_REMATCH[1]}-dev" >> "$GITHUB_OUTPUT"
elif [[ "$VERSION" =~ ^([0-9]+\.[0-9]+)\.[0-9]+$ ]]; then
echo "folder=$VERSION" >> "$GITHUB_OUTPUT"
echo "alias=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
else
echo "folder=$VERSION" >> "$GITHUB_OUTPUT"
fi
- name: Publish to gh-pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: packages/core/build/docs
target-folder: ${{ steps.dest.outputs.folder }}
# e.g. 4.0 always points to the docs of the latest 4.0.x release
- name: Publish version alias to gh-pages
if: steps.dest.outputs.alias
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: packages/core/build/docs
target-folder: ${{ steps.dest.outputs.alias }}