split release into multiple jobs

This commit is contained in:
Yoan.liu 2025-06-09 22:40:43 +08:00
parent 9b3c7e16c0
commit 4132ec3617
4 changed files with 247 additions and 17 deletions

View File

@ -6,7 +6,7 @@ on:
- "v[0-9]*"
jobs:
goreleaser:
prepare-ui:
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -19,34 +19,111 @@ jobs:
with:
node-version: 20.11.0
- name: Build WebUI
run: |
npm --prefix=./ui ci
npm --prefix=./ui run build
- name: Upload UI build artifacts
uses: actions/upload-artifact@v4
with:
name: ui-build
path: ./ui/dist
retention-days: 1
release-linux:
needs: prepare-ui
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
# - name: Install upx (optional)
# run: |
# sudo apt-get update
# sudo apt-get install -y upx
- name: Build WebUI
run: |
npm --prefix=./ui ci
npm --prefix=./ui run build
npm cache clean --force
rm -rf ./ui/node_modules
- name: Download UI build artifacts
uses: actions/download-artifact@v4
with:
name: ui-build
path: ./ui/dist
- name: Check disk usage
run: |
df -h
du -sh /opt/hostedtoolcache/go/*
run: df -h
- name: Run GoReleaser
- name: Run GoReleaser for Linux
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
args: release --clean --config .goreleaser.linux.yml
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
release-macos:
needs: prepare-ui
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Download UI build artifacts
uses: actions/download-artifact@v4
with:
name: ui-build
path: ./ui/dist
- name: Check disk usage
run: df -h
- name: Run GoReleaser for macOS
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --config .goreleaser.macos.yml
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
release-windows:
needs: prepare-ui
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Download UI build artifacts
uses: actions/download-artifact@v4
with:
name: ui-build
path: ./ui/dist
- name: Check disk usage
run: df -h
- name: Run GoReleaser for Windows
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --config .goreleaser.windows.yml
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}

52
.goreleaser.linux.yml Normal file
View File

@ -0,0 +1,52 @@
# .goreleaser.linux.yml
project_name: certimate
dist: .builds/linux
before:
hooks:
- go mod tidy
builds:
- id: build_linux
main: ./
binary: certimate
ldflags:
- -s -w -X github.com/usual2970/certimate.Version={{ .Version }}
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64
- arm
goarm:
- 7
release:
draft: true
ids:
- linux
archives:
- id: archive_linux
builds: [build_linux]
format: "zip"
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
files:
- CHANGELOG.md
- LICENSE.md
- README.md
checksum:
name_template: "checksums_linux.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^ui:"

49
.goreleaser.macos.yml Normal file
View File

@ -0,0 +1,49 @@
# .goreleaser.macos.yml
project_name: certimate
dist: .builds/macos
before:
hooks:
- go mod tidy
builds:
- id: build_macos
main: ./
binary: certimate
ldflags:
- -s -w -X github.com/usual2970/certimate.Version={{ .Version }}
env:
- CGO_ENABLED=0
goos:
- darwin
goarch:
- amd64
- arm64
release:
draft: true
ids:
- macos
archives:
- id: archive_macos
builds: [build_macos]
format: "zip"
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
files:
- CHANGELOG.md
- LICENSE.md
- README.md
checksum:
name_template: "checksums_macos.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^ui:"

52
.goreleaser.windows.yml Normal file
View File

@ -0,0 +1,52 @@
# .goreleaser.windows.yml
project_name: certimate
dist: .builds/windows
before:
hooks:
- go mod tidy
builds:
- id: build_windows
main: ./
binary: certimate
ldflags:
- -s -w -X github.com/usual2970/certimate.Version={{ .Version }}
env:
- CGO_ENABLED=0
goos:
- windows
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm
release:
draft: true
ids:
- windows
archives:
- id: archive_windows
builds: [build_windows]
format: "zip"
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
files:
- CHANGELOG.md
- LICENSE.md
- README.md
checksum:
name_template: "checksums_windows.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^ui:"