ci(release): test and package five native platforms in one workflow

This commit is contained in:
eezd committed 2026-10-27 14:47:25 +08:00
1 parent e239fff253
commit 8934d566c1
3 files changed
+106 -24

No files matched your search

+38 -13
View File
@@ -55,18 +55,39 @@ jobs:
with:
path: web/dist-demo
linux:
native:
needs: check
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
- os: linux
arch: amd64
runner: ubuntu-24.04
- arch: arm64
extension: ''
- os: linux
arch: arm64
runner: ubuntu-24.04-arm
extension: ''
- os: windows
arch: amd64
runner: windows-2025
extension: '.exe'
- os: darwin
arch: arm64
runner: macos-15
extension: ''
- os: darwin
arch: amd64
runner: macos-15-intel
extension: ''
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
defaults:
run:
shell: bash
env:
CGO_ENABLED: '0'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
@@ -77,30 +98,34 @@ jobs:
name: frontend
path: web/dist
- name: Build and smoke-test native binary
env:
EXE: ${{ matrix.extension }}
run: |
mkdir -p package/licenses
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X main.releaseVersion=$(cat VERSION)" -o package/rawmark ./cmd/rawmark
go test ./cmd/rawmark ./web
python3 scripts/smoke-release.py package/rawmark
go build -trimpath -ldflags="-s -w -X main.releaseVersion=$(cat VERSION)" -o "package/rawmark$EXE" ./cmd/rawmark
go vet ./...
go test ./internal/... ./cmd/rawmark ./web
python scripts/smoke-release.py "package/rawmark$EXE"
- name: Package download
env:
ARCH: ${{ matrix.arch }}
TARGET_OS: ${{ matrix.os }}
run: |
cp LICENSE package/
cp web/LICENSE package/licenses/vue3-starter-MIT.txt
cp web/src/common/appearance/fonts/*-OFL.txt package/licenses/
cp web/src/common/appearance/fonts/maple/LICENSE.txt package/licenses/Maple-Mono-OFL.txt
mkdir downloads
tar -C package -czf "downloads/rawmark_$(cat VERSION)_linux_$ARCH.tar.gz" rawmark LICENSE licenses
python scripts/package-release.py "$TARGET_OS" "$ARCH"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: linux-${{ matrix.arch }}
path: downloads/*.tar.gz
name: native-${{ matrix.os }}-${{ matrix.arch }}
path: downloads/*
if-no-files-found: error
retention-days: 3
image:
needs: linux
needs: native
runs-on: ubuntu-24.04
timeout-minutes: 20
permissions:
@@ -112,7 +137,7 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: linux-*
pattern: native-linux-*
path: downloads
merge-multiple: true
- name: Prepare tested binaries
@@ -186,7 +211,7 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: linux-*
pattern: native-*
path: downloads
merge-multiple: true
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
@@ -201,6 +226,6 @@ jobs:
RELEASE_TAG: ${{ github.ref_name }}
IMAGE_DIGEST: ${{ needs.image.outputs.digest }}
run: |
(cd downloads && sha256sum *.tar.gz > SHA256SUMS)
(cd downloads && sha256sum *.tar.gz *.zip > SHA256SUMS)
gh release create "$RELEASE_TAG" downloads/* --verify-tag --title "RawMark $RELEASE_TAG" --notes-file .github/release-notes.md --latest
docker buildx imagetools create --tag "ghcr.io/eezd/rawmark:$(cat VERSION)" --tag ghcr.io/eezd/rawmark:latest "ghcr.io/eezd/rawmark@$IMAGE_DIGEST"