-
-
Notifications
You must be signed in to change notification settings - Fork 8
66 lines (53 loc) · 1.93 KB
/
release.yaml
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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Bump version (e.g., 4.0.0, 4.1.0-alpha.1, 5.0.0-beta.2)'
required: true
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- id: version
run: |
VERSION="${{ github.event.inputs.version }}"
if [[ $VERSION =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-([a-z]+)\.([1-9][0-9]*))?$ ]]; then
if [[ "${BASH_REMATCH[5]}" == "latest" ]]; then
echo "INVALID VERSION FORMAT ('latest' is not allowed): $VERSION" >&2
exit 1
fi
echo "major=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
echo "minor=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT
echo "patch=${BASH_REMATCH[3]}" >> $GITHUB_OUTPUT
echo "preid=${BASH_REMATCH[5]}" >> $GITHUB_OUTPUT
echo "number=${BASH_REMATCH[6]}" >> $GITHUB_OUTPUT
else
echo "INVALID VERSION FORMAT: $VERSION" >&2
exit 1
fi
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- run: pnpm i
- run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- run: pnpm run packages:bump ${{ github.event.inputs.version }} --yes
- run: pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: pnpm run packages:publish --tag=${{ steps.version.outputs.preid || 'latest' }}
env:
NPM_CONFIG_PROVENANCE: true
- run: pnpm run packages:changelog:github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}