Skip to content
This repository was archived by the owner on Jul 8, 2026. It is now read-only.

Commit cafc621

Browse files
committed
feat(upgrade): add beta channel support via script argument
1 parent 287ea9f commit cafc621

2 files changed

Lines changed: 61 additions & 53 deletions

File tree

.github/workflows/build-beta.yml

Lines changed: 37 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Beta Version
1+
name: Build and Deploy Beta Pre-release
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
build-and-package-beta:
10+
build-and-release-beta:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout repository
@@ -25,47 +25,42 @@ jobs:
2525
go mod init hysteria_auth
2626
go mod tidy
2727
28-
- name: Build for linux-amd64
29-
run: (cd core/scripts/auth && GOOS=linux GOARCH=amd64 go build -o user_auth .)
30-
31-
- name: Upload amd64 Beta Artifact
32-
uses: actions/upload-artifact@v4
33-
with:
34-
name: Blitz-amd64
35-
path: |
36-
.
37-
!.git/**
38-
!.github/**
39-
!*.zip
40-
!.gitignore
41-
!CONTRIBUTING.md
42-
!LICENSE
43-
!README*.md
44-
!SECURITY.md
45-
!changelog
46-
!core/scripts/auth/go.*
47-
!core/scripts/auth/user_auth.go
28+
- name: Build and Package for linux-amd64
29+
id: package_amd64
30+
run: |
31+
(cd core/scripts/auth && GOOS=linux GOARCH=amd64 go build -o user_auth .)
32+
zip_name="Blitz-amd64.zip"
33+
zip -r "$zip_name" . \
34+
-x ".git/*" ".github/*" "*.zip" ".gitignore" "CONTRIBUTING.md" \
35+
"LICENSE" "README*.md" "SECURITY.md" "changelog" \
36+
"core/scripts/auth/go.*" "core/scripts/auth/user_auth.go"
37+
rm core/scripts/auth/user_auth
38+
echo "zip_name=$zip_name" >> $GITHUB_OUTPUT
4839
49-
- name: Clean amd64 binary
50-
run: rm core/scripts/auth/user_auth
40+
- name: Build and Package for linux-arm64
41+
id: package_arm64
42+
run: |
43+
(cd core/scripts/auth && GOOS=linux GOARCH=arm64 go build -o user_auth .)
44+
zip_name="Blitz-arm64.zip"
45+
zip -r "$zip_name" . \
46+
-x ".git/*" ".github/*" "*.zip" ".gitignore" "CONTRIBUTING.md" \
47+
"LICENSE" "README*.md" "SECURITY.md" "changelog" \
48+
"core/scripts/auth/go.*" "core/scripts/auth/user_auth.go"
49+
rm core/scripts/auth/user_auth
50+
echo "zip_name=$zip_name" >> $GITHUB_OUTPUT
5151
52-
- name: Build for linux-arm64
53-
run: (cd core/scripts/auth && GOOS=linux GOARCH=arm64 go build -o user_auth .)
52+
- name: Get latest commit message for release body
53+
id: get_commit_message
54+
run: echo "message=$(git log -1 --pretty=format:%s)" >> $GITHUB_OUTPUT
5455

55-
- name: Upload arm64 Beta Artifact
56-
uses: actions/upload-artifact@v4
56+
- name: Create Beta GitHub Release
57+
uses: softprops/action-gh-release@v2
5758
with:
58-
name: Blitz-arm64
59-
path: |
60-
.
61-
!.git/**
62-
!.github/**
63-
!*.zip
64-
!.gitignore
65-
!CONTRIBUTING.md
66-
!LICENSE
67-
!README*.md
68-
!SECURITY.md
69-
!changelog
70-
!core/scripts/auth/go.*
71-
!core/scripts/auth/user_auth.go
59+
tag_name: beta
60+
name: "Beta Build"
61+
body: "Latest beta build. Last commit: ${{ steps.get_commit_message.outputs.message }}"
62+
files: |
63+
${{ steps.package_amd64.outputs.zip_name }}
64+
${{ steps.package_arm64.outputs.zip_name }}
65+
prerelease: true
66+
draft: false

upgrade.sh

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
set -euo pipefail
44
trap 'echo -e "\n❌ An error occurred. Aborting."; exit 1' ERR
55

6-
# ========== Variables ==========
7-
HYSTERIA_INSTALL_DIR="/etc/hysteria"
8-
HYSTERIA_VENV_DIR="$HYSTERIA_INSTALL_DIR/hysteria2_venv"
9-
GEOSITE_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat"
10-
GEOIP_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat"
11-
MIGRATE_SCRIPT_PATH="$HYSTERIA_INSTALL_DIR/core/scripts/db/migrate_users.py"
12-
136
# ========== Color Setup ==========
147
GREEN=$(tput setaf 2)
158
RED=$(tput setaf 1)
@@ -22,6 +15,26 @@ success() { echo -e "${GREEN}[$(date '+%Y-%m-%d %H:%M:%S')] [OK] - ${RESET} $1";
2215
warn() { echo -e "${YELLOW}[$(date '+%Y-%m-%d %H:%M:%S')] [WARN] - ${RESET} $1"; }
2316
error() { echo -e "${RED}[$(date '+%Y-%m-%d %H:%M:%S')] [ERROR] - ${RESET} $1"; }
2417

18+
# ========== Variables and Argument Parsing ==========
19+
echo "Usage: $0 [beta]"
20+
echo " (no argument) - Upgrades to the latest stable release."
21+
echo " beta - Upgrades to the latest beta pre-release."
22+
echo "--------------------------------------------------------"
23+
24+
RELEASE_TAG="beta"
25+
if [[ "${1:-}" == "beta" ]]; then
26+
info "Beta flag detected. Targeting beta pre-release."
27+
RELEASE_TAG="beta"
28+
else
29+
info "Targeting the latest stable release."
30+
fi
31+
32+
HYSTERIA_INSTALL_DIR="/etc/hysteria"
33+
HYSTERIA_VENV_DIR="$HYSTERIA_INSTALL_DIR/hysteria2_venv"
34+
GEOSITE_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat"
35+
GEOIP_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat"
36+
MIGRATE_SCRIPT_PATH="$HYSTERIA_INSTALL_DIR/core/scripts/db/migrate_users.py"
37+
2538
# ========== Check AVX Support ==========
2639
check_avx_support() {
2740
info "Checking CPU for AVX support (required for MongoDB)..."
@@ -94,7 +107,7 @@ migrate_json_to_mongo() {
94107
fi
95108
}
96109

97-
download_and_extract_latest_release() {
110+
download_and_extract_release() {
98111
local arch
99112
case $(uname -m) in
100113
x86_64) arch="amd64" ;;
@@ -107,10 +120,10 @@ download_and_extract_latest_release() {
107120
info "Detected architecture: $arch"
108121

109122
local zip_name="Blitz-${arch}.zip"
110-
local download_url="https://github.com/ReturnFI/Blitz/releases/latest/download/${zip_name}"
123+
local download_url="https://github.com/ReturnFI/Blitz/releases/download/${RELEASE_TAG}/${zip_name}"
111124
local temp_zip="/tmp/${zip_name}"
112125

113-
info "Downloading latest release from ${download_url}..."
126+
info "Downloading release from ${download_url}..."
114127
if ! curl -sL -o "$temp_zip" "$download_url"; then
115128
error "Failed to download the release asset. Please check the URL and your connection."
116129
exit 1
@@ -190,7 +203,7 @@ for FILE in "${FILES[@]}"; do
190203
done
191204

192205
# ========== Download and Replace Installation ==========
193-
download_and_extract_latest_release
206+
download_and_extract_release
194207

195208
# ========== Download Geo Data ==========
196209
info "Downloading geosite.dat and geoip.dat..."

0 commit comments

Comments
 (0)