-
-
Notifications
You must be signed in to change notification settings - Fork 8
74 lines (64 loc) · 1.83 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
semver:
description: 'Version increment type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip-release]')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run validation
run: pnpm validate
- name: Configure NPM authentication
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Configure Git
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Set SemVer
id: set_semver
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "SEMVER=${{ github.event.inputs.semver }}" >> $GITHUB_ENV
else
echo "SEMVER=patch" >> $GITHUB_ENV
fi
- name: Execute Release
run: pnpm release ${{ env.SEMVER }} --ci
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}