1 Commits

Author SHA1 Message Date
kone 4c91de26cc chore: prepare v0.1.146 release
Release Image / image (push) Successful in 2m54s
2026-06-09 01:00:41 +08:00
3 changed files with 6 additions and 34 deletions
+2 -30
View File
@@ -81,18 +81,6 @@ jobs:
docker push "$IMAGE_NAME:$VERSION"
docker push "$IMAGE_NAME:latest"
- name: Build binary
run: |
set -eu
cd backend
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags "-s -w -X main.Version=${VERSION} -X main.Commit=${COMMIT} -X main.BuildDate=${BUILD_DATE}" \
-o /tmp/sub2api \
./cmd/server
cd /tmp
tar -czf "sub2api_linux_amd64.tar.gz" sub2api
sha256sum "sub2api_linux_amd64.tar.gz" > checksums.txt
- name: Create Gitea release
env:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
@@ -100,25 +88,9 @@ jobs:
set -eu
BODY="Docker image: ${IMAGE_NAME}:${VERSION}"
PAYLOAD=$(printf '{"tag_name":"%s","target_commitish":"%s","name":"Sub2API %s","body":"%s","draft":false,"prerelease":false}' "$TAG" "$(git rev-parse HEAD)" "$VERSION" "$BODY")
RELEASE_ID=$(curl -fsS \
curl -fsS \
-X POST \
-H "Authorization: token ${RELEASE_TOKEN}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
"$GITEA_API_URL/repos/$GITEA_OWNER/$GITEA_REPO/releases" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
# Upload binary archive
curl -fsS \
-X POST \
-H "Authorization: token ${RELEASE_TOKEN}" \
-H "Content-Type: application/octet-stream" \
--data-binary @/tmp/sub2api_linux_amd64.tar.gz \
"$GITEA_API_URL/repos/$GITEA_OWNER/$GITEA_REPO/releases/${RELEASE_ID}/assets?name=sub2api_linux_amd64.tar.gz"
# Upload checksums
curl -fsS \
-X POST \
-H "Authorization: token ${RELEASE_TOKEN}" \
-H "Content-Type: text/plain" \
--data-binary @/tmp/checksums.txt \
"$GITEA_API_URL/repos/$GITEA_OWNER/$GITEA_REPO/releases/${RELEASE_ID}/assets?name=checksums.txt"
"$GITEA_API_URL/repos/$GITEA_OWNER/$GITEA_REPO/releases" || true
+1 -1
View File
@@ -1 +1 @@
0.1.140
0.1.146
+3 -3
View File
@@ -22,11 +22,11 @@ import (
const (
updateCacheKey = "update_check_cache"
updateCacheTTL = 1200 // 20 minutes
defaultGitHubRepo = "kgod/sub2api"
defaultGitHubRepo = "man209111-cpu/sub2api"
// Security: allowed download domains for updates
allowedDownloadHost = "git.jianshixingqiu.com"
allowedAssetHost = "8.138.12.104"
allowedDownloadHost = "github.com"
allowedAssetHost = "objects.githubusercontent.com"
// Security: max download size (500MB)
maxDownloadSize = 500 * 1024 * 1024