-
Notifications
You must be signed in to change notification settings - Fork 597
86 lines (82 loc) · 2.85 KB
/
publish.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
name: Publish
on:
workflow_dispatch:
inputs:
versionType:
type: choice
description: "<major|minor|patch>"
required: true
default: "patch"
options:
- major
- minor
- patch
jobs:
publish:
name: Publish ${{ inputs.versionType }} release
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Prepare Node
uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install
run: pnpm i
- id: update-version
shell: bash
name: Bump version
# Use npm because yarn is for some reason not able to output only the version name
run: |
echo "version=$(pnpm run publish ${{ inputs.versionType }} | tail -n1)" >> $GITHUB_OUTPUT
git add .
- name: Conventional Changelog Action
id: build-changelog
uses: TriPSs/conventional-changelog-action@v5
with:
github-token: ${{ secrets.github_token }}
git-message: "chore(release): {version} 🤖"
git-user-name: "github-actions[bot]"
git-user-email: "41898282+github-actions[bot]@users.noreply.github.com"
preset: "conventionalcommits"
tag-prefix: "v"
# output-file: "UPDATELOG.md" # Since v1.4.3, using conventional-changelog-cli@v2.1.0
release-count: "10"
pre-changelog-generation: ".github/conventional-changelog/pre-changelog-generation.cjs"
config-file-path: ".github/conventional-changelog/config.cjs"
git-branch: "main"
env:
NYANPASU_VERSION: ${{ steps.update-version.outputs.version }}
GITHUB_TOKEN: ${{ secrets.github_token }}
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
body: ${{steps.build-changelog.outputs.clean_changelog}}
name: Clash Nyanpasu v${{steps.update-version.outputs.version}}
tag_name: ${{steps.build-changelog.outputs.tag}}
# target_commitish: ${{ steps.tag.outputs.sha }}