-
Notifications
You must be signed in to change notification settings - Fork 2
61 lines (51 loc) · 1.58 KB
/
release.yml
File metadata and controls
61 lines (51 loc) · 1.58 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
name: Release
on:
push:
branches:
- main
- alpha
- beta
- canary
- next
- next-major
- '[0-9]+.x'
permissions:
issues: write
contents: write
pull-requests: write
jobs:
release:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: ./setup-node-and-install
- name: validate before release
run: |
pnpm install
pnpm lint
pnpm test
env:
CI: true
- name: semantic release
id: semantic
uses: docker://ghcr.io/codfish/semantic-release-action@sha256:c6a4e05d93f73f2870887434c1286df7a23a55770be16cb826b6e2432f92e650
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Update major version tag
if: steps.semantic.outputs.new-release-published == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${{ steps.semantic.outputs.release-major }}"
SHA="${{ steps.semantic.outputs.git-head }}"
# Update existing major tag or create it (update first to avoid "Reference already exists")
gh api --method PATCH /repos/${{ github.repository }}/git/refs/tags/${TAG} \
-f sha="${SHA}" -F force=true \
|| gh api --method POST /repos/${{ github.repository }}/git/refs \
-f ref="refs/tags/${TAG}" -f sha="${SHA}"