|
1 |
| -name: Release Build |
| 1 | +name: Release builds |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - tags: |
6 |
| - - "v*" |
7 |
| - workflow_dispatch: |
| 4 | + release: |
| 5 | + types: [ published ] |
8 | 6 |
|
9 |
| -concurrency: |
10 |
| - group: ${{ github.workflow }}-${{ github.ref }} |
11 |
| - cancel-in-progress: true |
| 7 | +permissions: |
| 8 | + contents: write |
12 | 9 |
|
13 | 10 | 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 | + |
| 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 |
15 | 26 | strategy:
|
16 | 27 | 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' || '' }} |
26 | 31 | runs-on: ubuntu-latest
|
27 | 32 | steps:
|
28 |
| - - name: Checkout |
29 |
| - uses: actions/checkout@v4 |
30 | 33 |
|
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 |
33 | 45 |
|
34 | 46 | - name: Setup Go
|
35 | 47 | uses: actions/setup-go@v5
|
36 | 48 | with:
|
37 |
| - go-version: "1.24.5" |
| 49 | + go-version: '1.24' |
38 | 50 |
|
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 |
47 | 53 | 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 |
59 | 55 |
|
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 |
65 | 63 |
|
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 }} |
74 | 70 |
|
75 |
| - - name: Create Release |
| 71 | + - name: Upload assets |
76 | 72 | uses: softprops/action-gh-release@v2
|
77 | 73 | with:
|
78 |
| - tag_name: ${{ github.ref_name }} |
79 |
| - name: ${{ github.ref_name }} # 这里保证 release 名称就是 v1.1.1 |
80 |
| - draft: false |
| 74 | + files: build/compress/* |
81 | 75 | 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