-
Notifications
You must be signed in to change notification settings - Fork 25
97 lines (83 loc) · 2.88 KB
/
Release-Manual.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Release-Manual
on:
workflow_dispatch:
inputs:
ref:
description: Git reference for what to push
default: master
required: true
version:
description: Version to release
required: true
prerelease:
description: Prerelease
default: false
required: false
type: boolean
jobs:
release:
runs-on: ubuntu-latest
environment: production
name: Build & release
steps:
- name: Check version format for prerelease
uses: actions-ecosystem/action-regex-match@v2
id: regex-match1
with:
text: ${{ github.event.inputs.version }}
regex: '^\d+\.\d+\.\d+-dev\.\d+$'
if: ${{ github.event.inputs.prerelease == 'true' }}
- name: Check version format for stable release
uses: actions-ecosystem/action-regex-match@v2
id: regex-match2
with:
text: ${{ github.event.inputs.version }}
regex: '^\d+\.\d+\.\d+$'
if: ${{ github.event.inputs.prerelease == 'false' }}
- name: Fail if version format is incorrect
run: |
echo -e "::error::Incorrect version format\nPrerelease version format example: 2.0.0-dev.0\nStable version format example: 2.0.0"
exit 1
if: ${{ steps.regex-match1.outputs.match == '' && steps.regex-match2.outputs.match == '' }}
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm lint --quiet
- name: Update version in package.json
run: pnpm version ${{ github.event.inputs.version }} --no-git-tag-version
- name: Build
run: pnpm build
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Create changelog
run: |
echo -e "## What's Changed\n" >> changelog.txt
git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"* %B" > changelog.txt
- name: Create build.zip
run: zip -r ../build/Shoko-WebUI-v${{ github.event.inputs.version }}.zip ./* -x "**/*.js.map"
working-directory: ./dist
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: ./build/Shoko-WebUI-v${{ github.event.inputs.version }}.zip
tag_name: v${{ github.event.inputs.version }}
prerelease: ${{ github.event.inputs.prerelease }}
fail_on_unmatched_files: true
body_path: ./changelog.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}