chore: publish tag alpha support
chore: update alpha and release workflows to include version consistency checks
This commit is contained in:
33
.github/workflows/alpha.yml
vendored
33
.github/workflows/alpha.yml
vendored
@@ -6,6 +6,10 @@ on:
|
|||||||
# 应当通过 git tag 来触发构建
|
# 应当通过 git tag 来触发构建
|
||||||
# workflow_dispatch:
|
# workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
|
# 应当限制在 dev 分支上触发发布。
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
# 应当限制 v*.*.*-alpha* 的 tag 来触发发布。
|
||||||
tags:
|
tags:
|
||||||
- "v*.*.*-alpha*"
|
- "v*.*.*-alpha*"
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
@@ -18,8 +22,37 @@ concurrency:
|
|||||||
group: "${{ github.workflow }} - ${{ github.head_ref || github.ref }}"
|
group: "${{ github.workflow }} - ${{ github.head_ref || github.ref }}"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check_alpha_tag:
|
||||||
|
name: Check Alpha Tag package.json Version Consistency
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check tag and package.json version
|
||||||
|
id: check_tag
|
||||||
|
run: |
|
||||||
|
TAG_REF="${GITHUB_REF##*/}"
|
||||||
|
echo "Current tag: $TAG_REF"
|
||||||
|
if [[ ! "$TAG_REF" =~ -alpha ]]; then
|
||||||
|
echo "Current tag is not an alpha tag."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
PKG_VERSION=$(jq -r .version package.json)
|
||||||
|
echo "package.json version: $PKG_VERSION"
|
||||||
|
if [[ "$PKG_VERSION" != *alpha* ]]; then
|
||||||
|
echo "package.json version is not an alpha version."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ "$TAG_REF" != "v$PKG_VERSION" ]]; then
|
||||||
|
echo "Tag ($TAG_REF) does not match package.json version (v$PKG_VERSION)."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Alpha tag and package.json version are consistent."
|
||||||
|
|
||||||
delete_old_assets:
|
delete_old_assets:
|
||||||
name: Delete Old Alpha Release Assets and Tags
|
name: Delete Old Alpha Release Assets and Tags
|
||||||
|
needs: check_alpha_tag
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Delete Old Alpha Tags Except Latest
|
- name: Delete Old Alpha Tags Except Latest
|
||||||
|
|||||||
27
.github/workflows/release.yml
vendored
27
.github/workflows/release.yml
vendored
@@ -5,9 +5,10 @@ on:
|
|||||||
# ! 不再使用 workflow_dispatch 触发。
|
# ! 不再使用 workflow_dispatch 触发。
|
||||||
# workflow_dispatch:
|
# workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
# ? 应当限制在 main 分支上触发发布。
|
# 应当限制在 main 分支上触发发布。
|
||||||
# branches:
|
branches:
|
||||||
# - main
|
- main
|
||||||
|
# 应当限制 v*.*.* 的 tag 触发发布。
|
||||||
tags:
|
tags:
|
||||||
- "v*.*.*"
|
- "v*.*.*"
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
@@ -20,8 +21,28 @@ concurrency:
|
|||||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check_tag_version:
|
||||||
|
name: Check Release Tag and package.json Version Consistency
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check tag and package.json version
|
||||||
|
run: |
|
||||||
|
TAG_REF="${GITHUB_REF##*/}"
|
||||||
|
echo "Current tag: $TAG_REF"
|
||||||
|
PKG_VERSION=$(jq -r .version package.json)
|
||||||
|
echo "package.json version: $PKG_VERSION"
|
||||||
|
if [[ "$TAG_REF" != "v$PKG_VERSION" ]]; then
|
||||||
|
echo "Tag ($TAG_REF) does not match package.json version (v$PKG_VERSION)."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Tag and package.json version are consistent."
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Release Build
|
name: Release Build
|
||||||
|
needs: check_tag_version
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "clash-verge",
|
"name": "clash-verge",
|
||||||
"version": "2.3.0-alpha",
|
"version": "2.3.0",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env RUST_BACKTRACE=1 tauri dev -f verge-dev",
|
"dev": "cross-env RUST_BACKTRACE=1 tauri dev -f verge-dev",
|
||||||
@@ -112,4 +112,4 @@
|
|||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"packageManager": "pnpm@9.13.2"
|
"packageManager": "pnpm@9.13.2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const runRelease = () =>
|
|||||||
|
|
||||||
// 2. 判断是否需要打 tag
|
// 2. 判断是否需要打 tag
|
||||||
function isSemver(version) {
|
function isSemver(version) {
|
||||||
return /^v?\d+\.\d+\.\d+(-alpha)?$/.test(version);
|
return /^v?\d+\.\d+\.\d+(-[0-9A-Za-z-.]+)?$/.test(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
|
|||||||
Reference in New Issue
Block a user