From bc56b340a803cd782123a305b734b0257c0e23a7 Mon Sep 17 00:00:00 2001 From: jbergner Date: Wed, 6 Aug 2025 04:58:30 +0200 Subject: [PATCH] =?UTF-8?q?Neuer=20Worfklow=20f=C3=BCr=20Alpine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/release.yml | 45 ++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 8316991..8cac988 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,11 +1,12 @@ # Git(tea) Actions workflow: Build and publish standalone binaries # ──────────────────────────────────────────────────────────────────── -# ✧ Builds the Go‑based WoL server for three targets -# • linux/amd64 → wol-server-linux-amd64.tar.gz -# • linux/arm64 → wol-server-linux-arm64.tar.gz (Raspberry Pi 4/5, 64‑bit OS) -# • windows/amd64 → wol-server-windows-amd64.zip -# ✧ Uploads artifacts to the workflow and, if a tag (vX.Y.Z) is pushed, -# attaches them to the corresponding release. +# ✧ Builds the Go‑based WoL server for four targets +# • linux/amd64 → wol-server-linux-amd64.tar.gz +# • linux/arm64 → wol-server-linux-arm64.tar.gz (Raspberry Pi 4/5, 64‑bit OS) +# • linux/arm/v7 → wol-server-linux-armv7.tar.gz (Raspberry Pi 2/3, 32‑bit OS) +# • windows/amd64 → wol-server-windows-amd64.zip +# ✧ Uploads artifacts to the workflow and, on tag push (vX.Y.Z), +# attaches them to a GitHub/Gitea release. # # Secrets/variables: # GITEA_TOKEN – optional, only needed if default token lacks release perms. @@ -28,15 +29,19 @@ jobs: - goos: linux goarch: amd64 ext: "" - - goos: linux # Raspberry Pi (64‑bit) + - goos: linux # Raspberry Pi (64‑bit) goarch: arm64 ext: "" + - goos: linux # Raspberry Pi (32‑bit, armv7) + goarch: arm + goarm: "7" + ext: "" - goos: windows goarch: amd64 ext: ".exe" env: - GO_VERSION: "1.22" + GO_VERSION: "1.24" BINARY_NAME: wol-server steps: @@ -49,30 +54,36 @@ jobs: go-version: ${{ env.GO_VERSION }} cache: true - - name: Build ${{ matrix.goos }}/${{ matrix.goarch }} + - name: Build ${{ matrix.goos }}/${{ matrix.goarch }}${{ matrix.goarm && format('/v{0}', matrix.goarm) || '' }} shell: bash run: | + set -e mkdir -p dist - GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -trimpath -ldflags "-s -w" \ - -o "dist/${BINARY_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}" . + if [ -n "${{ matrix.goarm }}" ]; then export GOARM=${{ matrix.goarm }}; fi + CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -trimpath -ldflags "-s -w" \ + -o "dist/${BINARY_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}${{ matrix.ext }}" . - name: Package archive shell: bash run: | + set -e cd dist - FILE="${BINARY_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}" if [ "${{ matrix.goos }}" == "windows" ]; then - zip "${BINARY_NAME}-windows-amd64.zip" "$FILE" - rm "$FILE" + ZIP_NAME="${BINARY_NAME}-windows-amd64.zip" + zip "$ZIP_NAME" "${BINARY_NAME}-windows-amd64.exe" + rm "${BINARY_NAME}-windows-amd64.exe" else - tar -czf "${BINARY_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz" "$FILE" - rm "$FILE" + ARCH_SUFFIX="${{ matrix.goarch }}" + if [ "${{ matrix.goarch }}" == "arm" ]; then ARCH_SUFFIX="armv${{ matrix.goarm }}"; fi + TAR_NAME="${BINARY_NAME}-${{ matrix.goos }}-${ARCH_SUFFIX}.tar.gz" + tar -czf "$TAR_NAME" "${BINARY_NAME}-${{ matrix.goos }}-${ARCH_SUFFIX}" + rm "${BINARY_NAME}-${{ matrix.goos }}-${ARCH_SUFFIX}" fi - name: Upload workflow artifact uses: actions/upload-artifact@v3 with: - name: ${{ matrix.goos }}-${{ matrix.goarch }} + name: ${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }} path: | dist/*.zip dist/*.tar.gz