Skip to content

Commit d018ee5

Browse files
committed
更改自动云编译
1 parent b29e090 commit d018ee5

File tree

1 file changed

+70
-55
lines changed

1 file changed

+70
-55
lines changed

.github/workflows/release.yml

Lines changed: 70 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,92 @@
1-
name: Release builds
1+
name: Release Build
22

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

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

1013
jobs:
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
14+
build:
2615
strategy:
2716
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 }}
3126
runs-on: ubuntu-latest
3227
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
3330

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
4537

4638
- name: Setup Go
4739
uses: actions/setup-go@v5
4840
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"
6342

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
6745
env:
6846
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6947
FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
7048

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
7284
uses: softprops/action-gh-release@v2
7385
with:
74-
files: build/compress/*
86+
tag_name: ${{ steps.vars.outputs.tag }}
87+
name: Release ${{ steps.vars.outputs.tag }}
88+
draft: false
7589
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

Comments
 (0)