-
Notifications
You must be signed in to change notification settings - Fork 219
81 lines (70 loc) · 2.67 KB
/
Copy pathprepare_release.yml
File metadata and controls
81 lines (70 loc) · 2.67 KB
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
name: Prepare Release
permissions: {}
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (without v prefix, e.g. 0.1.0 or 0.1.0-alpha.0)'
required: true
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
prepare:
if: github.repository == 'voidzero-dev/vite-plus'
name: Prepare Release
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- uses: ./.github/actions/clone
- uses: oxc-project/setup-rust@68c3199c5339f965e6e163924c3c450773eba42b # main (pending v1.0.17 — Swatinem/rust-cache v2.9.1 for node24)
with:
save-cache: false
cache-key: lint
- uses: oxc-project/setup-node@4c588e9266bd930b6ddc34307df0659ed511d187 # v1.3.1
- name: Bump versions
env:
VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
update_json() {
local file=$1
sed -i -E "s/^(\s*\"version\":\s*)\"[^\"]+\"/\1\"$VERSION\"/" "$file"
grep -qF "\"version\": \"$VERSION\"" "$file" || { echo "::error::Failed to update $file"; exit 1; }
echo "Updated $file"
}
update_toml() {
local file=$1
sed -i -E "s/^version\s*=\s*\"[^\"]+\"/version = \"$VERSION\"/" "$file"
grep -qF "version = \"$VERSION\"" "$file" || { echo "::error::Failed to update $file"; exit 1; }
echo "Updated $file"
}
update_json packages/cli/package.json
update_json packages/core/package.json
update_toml packages/cli/binding/Cargo.toml
update_toml crates/vite_global_cli/Cargo.toml
- name: Refresh Cargo.lock
run: cargo check
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
client-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ steps.app-token.outputs.token }}
commit-message: 'release: v${{ inputs.version }}'
title: 'release: v${{ inputs.version }}'
branch: release/v${{ inputs.version }}
base: main
sign-commits: true
body: |
Release vite-plus v${{ inputs.version }}.
Merging this PR will trigger the release workflow.
assignees: fengmk2