-
Notifications
You must be signed in to change notification settings - Fork 77
58 lines (50 loc) · 1.71 KB
/
release.yml
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
name: release
on:
pull_request_target:
types: [closed]
branches:
- main
# Remove default permissions of GITHUB_TOKEN for security
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions: {}
jobs:
release:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'v')
concurrency:
group: release
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- run: npm i -g --force corepack && corepack enable
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: lts/*
registry-url: 'https://registry.npmjs.org/'
cache: pnpm
- name: 📦 Install dependencies
run: pnpm install
- name: 🛠 Build project
run: pnpm build
- name: 📦 Release
run: node ./scripts/release.mjs
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_RELEASE_TOKEN }}
NPM_CONFIG_PROVENANCE: true
- name: 🏷️ Create tag
run: |
TAG_NAME=${{ github.event.pull_request.head.ref }}
git tag $TAG_NAME
git push origin $TAG_NAME
- name: 🛳️ Create GitHub release
run: gh release create $TAG_NAME --title "$RELEASE_NAME" --notes "$BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.event.pull_request.head.ref }}
RELEASE_NAME: ${{ github.event.pull_request.head.ref }}
BODY: ${{ github.event.pull_request.body }}