Skip to content

Commit d9c4a57

Browse files
committed
恢复Release.yml
1 parent 6fd166b commit d9c4a57

File tree

1 file changed

+54
-62
lines changed

1 file changed

+54
-62
lines changed

.github/workflows/release.yml

Lines changed: 54 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,76 @@
1-
name: Release Build
1+
name: Release builds
22

33
on:
4-
push:
5-
tags:
6-
- "v*"
7-
workflow_dispatch:
4+
release:
5+
types: [ published ]
86

9-
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
11-
cancel-in-progress: true
7+
permissions:
8+
contents: write
129

1310
jobs:
14-
build:
11+
# Set release to prerelease first
12+
prerelease:
13+
name: Set Prerelease
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Prerelease
17+
uses: irongut/[email protected]
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
id: ${{ github.event.release.id }}
21+
prerelease: true
22+
23+
# Main release job for all platforms
24+
release:
25+
needs: prerelease
1526
strategy:
1627
matrix:
17-
target:
18-
- darwin-amd64
19-
- darwin-arm64
20-
- windows-amd64
21-
- linux-arm64-musl
22-
- linux-amd64-musl
23-
- windows-arm64
24-
- android-arm64
25-
name: Build ${{ matrix.target }}
28+
build-type: [ 'standard', 'lite' ]
29+
target-platform: [ '', 'android', 'freebsd', 'linux_musl', 'linux_musl_arm' ]
30+
name: Release ${{ matrix.target-platform && format('{0} ', matrix.target-platform) || '' }}${{ matrix.build-type == 'lite' && 'Lite' || '' }}
2631
runs-on: ubuntu-latest
2732
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v4
3033

31-
- uses: benjlevesque/[email protected]
32-
id: short-sha
34+
- name: Free Disk Space (Ubuntu)
35+
if: matrix.target-platform == ''
36+
uses: jlumbroso/free-disk-space@main
37+
with:
38+
tool-cache: false
39+
android: true
40+
dotnet: true
41+
haskell: true
42+
large-packages: true
43+
docker-images: true
44+
swap-storage: true
3345

3446
- name: Setup Go
3547
uses: actions/setup-go@v5
3648
with:
37-
go-version: "1.24.5"
49+
go-version: '1.24'
3850

39-
- name: Setup web
40-
run: bash build.sh dev web
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
44-
45-
- name: Build
46-
uses: OpenListTeam/[email protected]
51+
- name: Checkout
52+
uses: actions/checkout@v4
4753
with:
48-
targets: ${{ matrix.target }}
49-
musl-target-format: $os-$musl-$arch
50-
github-token: ${{ secrets.GITHUB_TOKEN }}
51-
out-dir: build
52-
x-flags: |
53-
github.com/OpenListTeam/OpenList/v4/internal/conf.BuiltAt=${{ github.run_id }}
54-
github.com/OpenListTeam/OpenList/v4/internal/conf.GitAuthor=The OpenList Projects Contributors <[email protected]>
55-
github.com/OpenListTeam/OpenList/v4/internal/conf.GitCommit=${{ steps.short-sha.outputs.sha }}
56-
github.com/OpenListTeam/OpenList/v4/internal/conf.Version=${{ github.ref_name }}
57-
github.com/OpenListTeam/OpenList/v4/internal/conf.WebVersion=rolling
58-
output: openlist$ext
54+
fetch-depth: 0
5955

60-
- name: Upload artifact
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: openlist_${{ matrix.target }}
64-
path: build/*
56+
- name: Install dependencies
57+
if: matrix.target-platform == ''
58+
run: |
59+
sudo snap install zig --classic --beta
60+
docker pull crazymax/xgo:latest
61+
go install github.com/crazy-max/xgo@latest
62+
sudo apt install upx
6563
66-
release:
67-
needs: build
68-
runs-on: ubuntu-latest
69-
steps:
70-
- name: Download artifacts
71-
uses: actions/download-artifact@v4
72-
with:
73-
path: artifacts
64+
- name: Build
65+
run: |
66+
bash build.sh release ${{ matrix.build-type == 'lite' && 'lite' || '' }} ${{ matrix.target-platform }}
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
7470

75-
- name: Create Release
71+
- name: Upload assets
7672
uses: softprops/action-gh-release@v2
7773
with:
78-
tag_name: ${{ github.ref_name }}
79-
name: ${{ github.ref_name }} # 这里保证 release 名称就是 v1.1.1
80-
draft: false
74+
files: build/compress/*
8175
prerelease: false
82-
files: artifacts/**/* # 明确包含所有 target 的文件
83-
env:
84-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
tag_name: ${{ github.event.release.tag_name }}

0 commit comments

Comments
 (0)