-
Notifications
You must be signed in to change notification settings - Fork 196
82 lines (71 loc) · 2.72 KB
/
prepare_release.yml
File metadata and controls
82 lines (71 loc) · 2.72 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
82
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
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@ab97f03642370d79a7e96dd286bd02a1be40e0ba # v1.3.0
- 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_json packages/test/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