Skip to content

Commit ff41145

Browse files
committed
change release ci flow
1 parent d581126 commit ff41145

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
name: release
22

33
on:
4-
push:
5-
tags:
6-
- "v[0-9]+.[0-9]+.[0-9]+"
4+
workflow_dispatch:
5+
inputs:
6+
bumpType:
7+
description: Bump Type
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
714

815
jobs:
916
publish:
1017
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
1120
steps:
1221
- name: Checkout
1322
uses: actions/checkout@v3
@@ -25,17 +34,33 @@ jobs:
2534
- run: pnpm install
2635
- run: pnpm test run
2736
- run: pnpm build
28-
- run: pnpm publish
37+
- name: Configure git user
38+
run: |
39+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
40+
git config user.name "github-actions[bot]"
41+
- name: Bump package.json version
42+
id: bump
43+
run: |
44+
pnpm version ${{ github.event.inputs.bumpType }}
45+
echo "VERSION=v$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
46+
- name: Commit and Push
47+
run: |
48+
git commit -am "Bump version up to ${{ steps.bump.outputs.VERSION }}"
49+
git push
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
- name: Tag and Push
53+
run: |
54+
git tag ${{ steps.bump.outputs.VERSION }}
55+
git push --tag
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
- name: Release
59+
run: |
60+
pnpm publish
2961
env:
3062
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3163

32-
release-note:
33-
runs-on: ubuntu-latest
34-
steps:
35-
- name: Checkout code
36-
uses: actions/checkout@v3
37-
with:
38-
fetch-depth: 0
3964
- name: Get the version
4065
id: get_version
4166
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
@@ -56,5 +81,5 @@ jobs:
5681
release_name: Release ${{ steps.get_version.outputs.VERSION }}
5782
body: |
5883
${{ steps.get_commit_summary.outputs.COMMIT_SUMMARY }}
59-
draft: false
60-
prerelease: false
84+
draft: true
85+
prerelease: true

0 commit comments

Comments
 (0)