Neuer Worfklow für Alpine
Some checks failed
release-tag / release-image (push) Successful in 1m44s
build-binaries / build (, amd64, linux) (push) Successful in 10m36s
build-binaries / build (, arm, 7, linux) (push) Has started running
build-binaries / build (, arm64, linux) (push) Has been cancelled
build-binaries / build (.exe, amd64, windows) (push) Has been cancelled
build-binaries / release (push) Has been cancelled

This commit is contained in:
2025-08-06 04:58:30 +02:00
parent 7aa01758f2
commit bc56b340a8

View File

@@ -1,11 +1,12 @@
# Git(tea) Actions workflow: Build and publish standalone binaries # Git(tea) Actions workflow: Build and publish standalone binaries
# ──────────────────────────────────────────────────────────────────── # ────────────────────────────────────────────────────────────────────
# ✧ Builds the Gobased WoL server for three targets # ✧ Builds the Gobased WoL server for four targets
# • linux/amd64 → wol-server-linux-amd64.tar.gz # • linux/amd64 → wol-server-linux-amd64.tar.gz
# • linux/arm64 → wol-server-linux-arm64.tar.gz (Raspberry Pi 4/5, 64bit OS) # • linux/arm64 → wol-server-linux-arm64.tar.gz (Raspberry Pi 4/5, 64bit OS)
# • linux/arm/v7 → wol-server-linux-armv7.tar.gz (Raspberry Pi 2/3, 32bit OS)
# • windows/amd64 → wol-server-windows-amd64.zip # • windows/amd64 → wol-server-windows-amd64.zip
# ✧ Uploads artifacts to the workflow and, if a tag (vX.Y.Z) is pushed, # ✧ Uploads artifacts to the workflow and, on tag push (vX.Y.Z),
# attaches them to the corresponding release. # attaches them to a GitHub/Gitea release.
# #
# Secrets/variables: # Secrets/variables:
# GITEA_TOKEN optional, only needed if default token lacks release perms. # GITEA_TOKEN optional, only needed if default token lacks release perms.
@@ -31,12 +32,16 @@ jobs:
- goos: linux # Raspberry Pi (64bit) - goos: linux # Raspberry Pi (64bit)
goarch: arm64 goarch: arm64
ext: "" ext: ""
- goos: linux # Raspberry Pi (32bit, armv7)
goarch: arm
goarm: "7"
ext: ""
- goos: windows - goos: windows
goarch: amd64 goarch: amd64
ext: ".exe" ext: ".exe"
env: env:
GO_VERSION: "1.22" GO_VERSION: "1.24"
BINARY_NAME: wol-server BINARY_NAME: wol-server
steps: steps:
@@ -49,30 +54,36 @@ jobs:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
cache: true cache: true
- name: Build ${{ matrix.goos }}/${{ matrix.goarch }} - name: Build ${{ matrix.goos }}/${{ matrix.goarch }}${{ matrix.goarm && format('/v{0}', matrix.goarm) || '' }}
shell: bash shell: bash
run: | run: |
set -e
mkdir -p dist mkdir -p dist
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -trimpath -ldflags "-s -w" \ if [ -n "${{ matrix.goarm }}" ]; then export GOARM=${{ matrix.goarm }}; fi
-o "dist/${BINARY_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}" . 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 - name: Package archive
shell: bash shell: bash
run: | run: |
set -e
cd dist cd dist
FILE="${BINARY_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}"
if [ "${{ matrix.goos }}" == "windows" ]; then if [ "${{ matrix.goos }}" == "windows" ]; then
zip "${BINARY_NAME}-windows-amd64.zip" "$FILE" ZIP_NAME="${BINARY_NAME}-windows-amd64.zip"
rm "$FILE" zip "$ZIP_NAME" "${BINARY_NAME}-windows-amd64.exe"
rm "${BINARY_NAME}-windows-amd64.exe"
else else
tar -czf "${BINARY_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz" "$FILE" ARCH_SUFFIX="${{ matrix.goarch }}"
rm "$FILE" 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 fi
- name: Upload workflow artifact - name: Upload workflow artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ matrix.goos }}-${{ matrix.goarch }} name: ${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}
path: | path: |
dist/*.zip dist/*.zip
dist/*.tar.gz dist/*.tar.gz