Skip to content

Commit 610ce08

Browse files
committed
feat(ci): release workflow
1 parent 7100c46 commit 610ce08

File tree

5 files changed

+90
-20
lines changed

5 files changed

+90
-20
lines changed

.github/workflows/deploy-gh-pages.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919

2020
- name: Install
2121
uses: ./.github/actions/install
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
2224

2325
- name: Repository Basename
2426
id: repository-basename

.github/workflows/publish-docker.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Publish Docker
22

33
on:
44
push:
5-
tags: ['*']
5+
tags:
6+
- 'v*'
67
workflow_dispatch:
78

89
env:

.github/workflows/publish-npm.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
name: Publish NPM
22

33
on:
4+
push:
5+
tags:
6+
- 'v*'
47
workflow_dispatch:
58
inputs:
6-
prerelease:
7-
description: 'Prerelease'
8-
type: boolean
9-
required: false
109
dry-run:
1110
description: 'Dry-run'
1211
type: boolean
1312
required: false
1413

1514
run-name: >-
1615
Publish
17-
${{ inputs.prerelease && format('[🧪 Prerelease]') || format('') }}
16+
${{ github.ref_name && format('{0}', github.ref_name) || format('') }}
1817
${{ inputs.dry-run && format('[🚫 Dry-Run]') || format('') }}
1918
2019
permissions:
21-
contents: write
2220
packages: write
2321

2422
concurrency: publish-npm
@@ -48,15 +46,6 @@ jobs:
4846
- name: Build
4947
run: pnpm build
5048

51-
- name: Git config
52-
run: |
53-
git config user.name "github-actions[bot]"
54-
git config user.email "github-actions[bot]@users.noreply.github.com"
55-
56-
- name: GitHub Packages config
57-
run: |
58-
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.npmrc
59-
6049
- name: Publish
6150
env:
6251
GITHUB_TOKEN: ${{ steps.auth.outputs.token }}
@@ -65,8 +54,5 @@ jobs:
6554
if [[ "${{ inputs.dry-run }}" == "true" ]]; then
6655
ARGS+="--dry-run "
6756
fi
68-
if [[ "${{ inputs.prerelease }}" == "true" ]]; then
69-
ARGS+="--conventional-prerelease "
70-
fi
7157
echo "$ARGS"
7258
bash -c "pnpm ci:publish $ARGS"

.github/workflows/release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bump:
7+
description: 'Bump'
8+
required: true
9+
type: choice
10+
options:
11+
- (auto)
12+
- patch
13+
- minor
14+
- major
15+
prerelease:
16+
description: 'Prerelease'
17+
type: boolean
18+
required: false
19+
dry-run:
20+
description: 'Dry-run'
21+
type: boolean
22+
required: false
23+
24+
run-name: >-
25+
Release
26+
${{ inputs.bump && format('[🚀 {0}]', inputs.bump) || format('') }}
27+
${{ inputs.prerelease && format('[🧪 Prerelease]') || format('') }}
28+
${{ inputs.dry-run && format('[🚫 Dry-Run]') || format('') }}
29+
30+
permissions:
31+
contents: write
32+
33+
concurrency: release
34+
35+
jobs:
36+
release:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Authenticate
40+
id: auth
41+
uses: actions/create-github-app-token@v1
42+
with:
43+
app-id: ${{ vars.CI_GITHUB_ACTIONS_APP_ID }}
44+
private-key: ${{ secrets.CI_GITHUB_ACTIONS_PRIVATE_KEY }}
45+
46+
- name: Checkout
47+
uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 0
50+
token: ${{ steps.auth.outputs.token }}
51+
52+
- name: Install
53+
uses: ./.github/actions/install
54+
with:
55+
token: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Build
58+
run: pnpm build
59+
60+
- name: Git config
61+
run: |
62+
git config user.name "github-actions[bot]"
63+
git config user.email "github-actions[bot]@users.noreply.github.com"
64+
65+
- name: Version
66+
env:
67+
GITHUB_TOKEN: ${{ steps.auth.outputs.token }}
68+
run: |
69+
ARGS=""
70+
if [[ "${{ inputs.bump }}" == "(auto)" ]]; then
71+
ARGS+="${{ inputs.prerelease && format('--conventional-prerelease') || format('') }} "
72+
else
73+
ARGS+="${{ inputs.prerelease && format('pre{0}', inputs.bump) || inputs.bump }} "
74+
fi
75+
if [[ "${{ inputs.dry-run }}" == "true" ]]; then
76+
ARGS+="--dry-run "
77+
fi
78+
ARGS+="--yes "
79+
echo "$ARGS"
80+
bash -c "pnpm ci:release $ARGS"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"format": "prettier . --write --ignore-unknown",
1919
"lint": "eslint --cache .",
2020
"lerna": "lerna",
21-
"ci:publish": "lerna publish",
21+
"ci:release": "lerna version",
22+
"ci:publish": "lerna publish from-package",
2223
"prepare": "husky"
2324
},
2425
"devDependencies": {

0 commit comments

Comments
 (0)