|
1 |
| -name: Release builds |
| 1 | +name: Release Build |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - release: |
5 |
| - types: [ published ] |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + workflow_dispatch: |
6 | 8 |
|
7 |
| -permissions: |
8 |
| - contents: write |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
9 | 12 |
|
10 | 13 | jobs:
|
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 |
| 14 | + build: |
26 | 15 | strategy:
|
27 | 16 | matrix:
|
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' || '' }} |
| 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 }} |
31 | 26 | runs-on: ubuntu-latest
|
32 | 27 | steps:
|
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
33 | 30 |
|
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 |
| 31 | + - uses: benjlevesque/[email protected] |
| 32 | + id: short-sha |
| 33 | + |
| 34 | + - name: Get tag name |
| 35 | + id: vars |
| 36 | + run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT |
45 | 37 |
|
46 | 38 | - name: Setup Go
|
47 | 39 | uses: actions/setup-go@v5
|
48 | 40 | with:
|
49 |
| - go-version: '1.24' |
50 |
| - |
51 |
| - - name: Checkout |
52 |
| - uses: actions/checkout@v4 |
53 |
| - with: |
54 |
| - fetch-depth: 0 |
55 |
| - |
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 |
| 41 | + go-version: "1.24.5" |
63 | 42 |
|
64 |
| - - name: Build |
65 |
| - run: | |
66 |
| - bash build.sh release ${{ matrix.build-type == 'lite' && 'lite' || '' }} ${{ matrix.target-platform }} |
| 43 | + - name: Setup web |
| 44 | + run: bash build.sh dev web |
67 | 45 | env:
|
68 | 46 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
69 | 47 | FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
|
70 | 48 |
|
71 |
| - - name: Upload assets |
| 49 | + - name: Build |
| 50 | + uses: OpenListTeam/[email protected] |
| 51 | + with: |
| 52 | + targets: ${{ matrix.target }} |
| 53 | + musl-target-format: $os-$musl-$arch |
| 54 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + out-dir: build |
| 56 | + x-flags: | |
| 57 | + github.com/OpenListTeam/OpenList/v4/internal/conf.BuiltAt=${{ github.run_id }} |
| 58 | + github.com/OpenListTeam/OpenList/v4/internal/conf.GitAuthor=The OpenList Projects Contributors <[email protected]> |
| 59 | + github.com/OpenListTeam/OpenList/v4/internal/conf.GitCommit=${{ steps.short-sha.outputs.sha }} |
| 60 | + github.com/OpenListTeam/OpenList/v4/internal/conf.Version=${{ steps.vars.outputs.tag }} |
| 61 | + github.com/OpenListTeam/OpenList/v4/internal/conf.WebVersion=rolling |
| 62 | + output: openlist$ext |
| 63 | + |
| 64 | + - name: Upload artifact |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + with: |
| 67 | + name: openlist_${{ steps.vars.outputs.tag }}_${{ matrix.target }} |
| 68 | + path: build/* |
| 69 | + |
| 70 | + release: |
| 71 | + needs: build |
| 72 | + runs-on: ubuntu-latest |
| 73 | + steps: |
| 74 | + - name: Download artifacts |
| 75 | + uses: actions/download-artifact@v4 |
| 76 | + with: |
| 77 | + path: artifacts |
| 78 | + |
| 79 | + - name: Get tag name |
| 80 | + id: vars |
| 81 | + run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT |
| 82 | + |
| 83 | + - name: Create Release |
72 | 84 | uses: softprops/action-gh-release@v2
|
73 | 85 | with:
|
74 |
| - files: build/compress/* |
| 86 | + tag_name: ${{ steps.vars.outputs.tag }} |
| 87 | + name: Release ${{ steps.vars.outputs.tag }} |
| 88 | + draft: false |
75 | 89 | prerelease: false
|
76 |
| - tag_name: ${{ github.event.release.tag_name }} |
77 |
| - |
| 90 | + files: artifacts/**/* |
| 91 | + env: |
| 92 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments