Skip to content
This repository was archived by the owner on Jul 23, 2025. It is now read-only.

Commit a84ffb9

Browse files
authored
chore(ci):Simplify the build process (#686)
* refactor(ci):Minify build files
1 parent 19c6b6f commit a84ffb9

File tree

12 files changed

+43
-396
lines changed

12 files changed

+43
-396
lines changed

.github/workflows/beta_release.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ permissions:
1414

1515
jobs:
1616
changelog:
17-
strategy:
18-
matrix:
19-
platform: [ubuntu-latest]
20-
go-version: ["1.21"]
2117
name: Beta Release Changelog
22-
runs-on: ${{ matrix.platform }}
18+
runs-on: ubuntu-latest
2319
steps:
2420
- name: Checkout
2521
uses: actions/checkout@v4

.github/workflows/build.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
build:
1616
strategy:
1717
matrix:
18-
platform: [ubuntu-latest]
1918
target:
2019
- darwin-amd64
2120
- darwin-arm64
@@ -24,8 +23,8 @@ jobs:
2423
- linux-amd64-musl
2524
- windows-arm64
2625
- android-arm64
27-
name: Build
28-
runs-on: ${{ matrix.platform }}
26+
name: Build ${{ matrix.target }}
27+
runs-on: ubuntu-latest
2928
steps:
3029
- name: Checkout
3130
uses: actions/checkout@v4

.github/workflows/changelog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Automatic changelog
1+
name: Release Automatic changelog
22

33
on:
44
push:

.github/workflows/release.yml

Lines changed: 15 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -8,110 +8,53 @@ permissions:
88
contents: write
99

1010
jobs:
11-
release:
12-
strategy:
13-
matrix:
14-
platform: [ ubuntu-latest ]
15-
go-version: [ '1.21' ]
16-
name: Release
17-
runs-on: ${{ matrix.platform }}
11+
# Set release to prerelease first
12+
prerelease:
13+
name: Set Prerelease
14+
runs-on: ubuntu-latest
1815
steps:
19-
20-
- name: Free Disk Space (Ubuntu)
21-
uses: jlumbroso/free-disk-space@main
22-
with:
23-
# this might remove tools that are actually needed,
24-
# if set to "true" but frees about 6 GB
25-
tool-cache: false
26-
27-
# all of these default to true, but feel free to set to
28-
# "false" if necessary for your workflow
29-
android: true
30-
dotnet: true
31-
haskell: true
32-
large-packages: true
33-
docker-images: true
34-
swap-storage: true
35-
3616
- name: Prerelease
3717
uses: irongut/EditRelease@v1.2.0
3818
with:
3919
token: ${{ secrets.GITHUB_TOKEN }}
4020
id: ${{ github.event.release.id }}
4121
prerelease: true
4222

43-
- name: Setup Go
44-
uses: actions/setup-go@v5
45-
with:
46-
go-version: ${{ matrix.go-version }}
47-
48-
- name: Checkout
49-
uses: actions/checkout@v4
50-
with:
51-
fetch-depth: 0
52-
53-
- name: Install dependencies
54-
run: |
55-
sudo snap install zig --classic --beta
56-
docker pull crazymax/xgo:latest
57-
go install github.com/crazy-max/xgo@latest
58-
sudo apt install upx
59-
60-
- name: Build
61-
run: |
62-
bash build.sh release
63-
env:
64-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65-
66-
- name: Upload assets
67-
uses: softprops/action-gh-release@v2
68-
with:
69-
files: build/compress/*
70-
prerelease: false
71-
72-
release-lite:
23+
# Main release job for all platforms
24+
release:
25+
needs: prerelease
7326
strategy:
7427
matrix:
75-
platform: [ ubuntu-latest ]
76-
go-version: [ '1.21' ]
77-
name: Release Lite
78-
runs-on: ${{ matrix.platform }}
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' || '' }}
31+
runs-on: ubuntu-latest
7932
steps:
8033

8134
- name: Free Disk Space (Ubuntu)
35+
if: matrix.target-platform == ''
8236
uses: jlumbroso/free-disk-space@main
8337
with:
84-
# this might remove tools that are actually needed,
85-
# if set to "true" but frees about 6 GB
8638
tool-cache: false
87-
88-
# all of these default to true, but feel free to set to
89-
# "false" if necessary for your workflow
9039
android: true
9140
dotnet: true
9241
haskell: true
9342
large-packages: true
9443
docker-images: true
9544
swap-storage: true
9645

97-
- name: Prerelease
98-
uses: irongut/EditRelease@v1.2.0
99-
with:
100-
token: ${{ secrets.GITHUB_TOKEN }}
101-
id: ${{ github.event.release.id }}
102-
prerelease: true
103-
10446
- name: Setup Go
10547
uses: actions/setup-go@v5
10648
with:
107-
go-version: ${{ matrix.go-version }}
49+
go-version: '1.24'
10850

10951
- name: Checkout
11052
uses: actions/checkout@v4
11153
with:
11254
fetch-depth: 0
11355

11456
- name: Install dependencies
57+
if: matrix.target-platform == ''
11558
run: |
11659
sudo snap install zig --classic --beta
11760
docker pull crazymax/xgo:latest
@@ -120,7 +63,7 @@ jobs:
12063
12164
- name: Build
12265
run: |
123-
bash build.sh release lite
66+
bash build.sh release ${{ matrix.build-type == 'lite' && 'lite' || '' }} ${{ matrix.target-platform }}
12467
env:
12568
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12669

.github/workflows/release_android.yml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/release_docker.yml

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ env:
3333
ARTIFACT_NAME_LITE: 'binaries_docker_release_lite'
3434
RELEASE_PLATFORMS: 'linux/amd64,linux/arm64,linux/arm/v7,linux/386,linux/arm/v6,linux/s390x,linux/ppc64le,linux/riscv64'
3535
IMAGE_PUSH: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
36-
IMAGE_IS_PROD: ${{ github.ref_type == 'tag' || github.event.inputs.as_latest == 'true' }}
37-
IMAGE_TAGS_BETA: |
38-
type=raw,value=beta,enable={{is_default_branch}}
3936

4037
permissions:
4138
packages: write
@@ -65,14 +62,7 @@ jobs:
6562
env:
6663
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6764

68-
- name: Build go binary (beta)
69-
if: env.IMAGE_IS_PROD != 'true'
70-
run: bash build.sh beta docker-multiplatform
71-
env:
72-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73-
7465
- name: Build go binary (release)
75-
if: env.IMAGE_IS_PROD == 'true'
7666
run: bash build.sh release docker-multiplatform
7767
env:
7868
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -88,7 +78,7 @@ jobs:
8878
!build/musl-libs/**
8979
9080
build_binary_lite:
91-
name: Build Binaries for Docker Release
81+
name: Build Binaries for Docker Release (Lite)
9282
runs-on: ubuntu-latest
9383
steps:
9484
- name: Checkout
@@ -111,14 +101,7 @@ jobs:
111101
env:
112102
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113103

114-
- name: Build go binary (beta)
115-
if: env.IMAGE_IS_PROD != 'true'
116-
run: bash build.sh beta lite docker-multiplatform
117-
env:
118-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119-
120104
- name: Build go binary (release)
121-
if: env.IMAGE_IS_PROD == 'true'
122105
run: bash build.sh release lite docker-multiplatform
123106
env:
124107
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -181,7 +164,7 @@ jobs:
181164
if: env.IMAGE_PUSH == 'true'
182165
uses: docker/login-action@v3
183166
with:
184-
username: ${{ env.DOCKERHUB_ORG_NAME }}
167+
username: ${{ vars.DOCKERHUB_ORG_NAME_BACKUP || env.DOCKERHUB_ORG_NAME }}
185168
password: ${{ secrets.DOCKERHUB_TOKEN }}
186169

187170
- name: Docker meta
@@ -192,13 +175,11 @@ jobs:
192175
${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ env.IMAGE_NAME }}
193176
${{ env.DOCKERHUB_ORG_NAME }}/${{ env.IMAGE_NAME_DOCKERHUB }}
194177
tags: >
195-
${{ env.IMAGE_IS_PROD == 'true' && (
196-
github.event_name == 'workflow_dispatch'
178+
${{ github.event_name == 'workflow_dispatch'
197179
&& format('type=raw,value={0}', github.event.inputs.manual_tag)
198-
|| format('type=raw,value={0}', github.ref_name)
199-
) || env.IMAGE_TAGS_BETA }}
180+
|| format('type=raw,value={0}', github.ref_name) }}
200181
flavor: |
201-
latest=${{ env.IMAGE_IS_PROD }}
182+
latest=${{ github.event_name == 'push' || github.event.inputs.as_latest == 'true' }}
202183
${{ matrix.tag_favor }}
203184
204185
- name: Build and push
@@ -215,7 +196,7 @@ jobs:
215196

216197
release_docker_lite:
217198
needs: build_binary_lite
218-
name: Release Docker image
199+
name: Release Docker image (Lite)
219200
runs-on: ubuntu-latest
220201
strategy:
221202
matrix:
@@ -261,7 +242,7 @@ jobs:
261242
if: env.IMAGE_PUSH == 'true'
262243
uses: docker/login-action@v3
263244
with:
264-
username: ${{ env.DOCKERHUB_ORG_NAME }}
245+
username: ${{ vars.DOCKERHUB_ORG_NAME_BACKUP || env.DOCKERHUB_ORG_NAME }}
265246
password: ${{ secrets.DOCKERHUB_TOKEN }}
266247

267248
- name: Docker meta
@@ -272,13 +253,11 @@ jobs:
272253
${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ env.IMAGE_NAME }}
273254
${{ env.DOCKERHUB_ORG_NAME }}/${{ env.IMAGE_NAME_DOCKERHUB }}
274255
tags: >
275-
${{ env.IMAGE_IS_PROD == 'true' && (
276-
github.event_name == 'workflow_dispatch'
256+
${{ github.event_name == 'workflow_dispatch'
277257
&& format('type=raw,value={0}', github.event.inputs.manual_tag)
278-
|| format('type=raw,value={0}', github.ref_name)
279-
) || env.IMAGE_TAGS_BETA }}
258+
|| format('type=raw,value={0}', github.ref_name) }}
280259
flavor: |
281-
latest=${{ env.IMAGE_IS_PROD }}
260+
latest=${{ github.event_name == 'push' || github.event.inputs.as_latest == 'true' }}
282261
${{ matrix.tag_favor }}
283262
284263
- name: Build and push
@@ -291,4 +270,4 @@ jobs:
291270
build-args: ${{ matrix.build_arg }}
292271
tags: ${{ steps.meta.outputs.tags }}
293272
labels: ${{ steps.meta.outputs.labels }}
294-
platforms: ${{ env.RELEASE_PLATFORMS }}
273+
platforms: ${{ env.RELEASE_PLATFORMS }}

0 commit comments

Comments
 (0)