Update und Fix
All checks were successful
release-tag / release-image (push) Successful in 1m28s
build-binaries / build (, amd64, linux) (push) Successful in 10m30s
build-binaries / build (, arm64, linux) (push) Successful in 10m23s
build-binaries / build (.exe, amd64, windows) (push) Successful in 10m27s
build-binaries / release (push) Successful in 39s

This commit is contained in:
2025-08-05 19:52:31 +02:00
parent bcd5ccd0cf
commit 7aa01758f2

View File

@@ -1,18 +1,17 @@
# Git(tea) Actions workflow: Build and publish standalone binaries # Git(tea) Actions workflow: Build and publish standalone binaries
# ──────────────────────────────────────────────────────────────────── # ────────────────────────────────────────────────────────────────────
# ✧ Builds the Gobased WoL server for # ✧ Builds the Gobased WoL server for three 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)
# • windows/amd64 → wol-server-windows-amd64.zip # • windows/amd64 → wol-server-windows-amd64.zip
# ✧ Attaches the archives as workflow artifacts **and** to a tagbased release # ✧ Uploads artifacts to the workflow and, if a tag (vX.Y.Z) is pushed,
# (vX.Y.Z). If the push is to main (without tag), the artifacts are still # attaches them to the corresponding release.
# available in the workflow run.
# #
# Prerequisites (⇔ repository secrets / variables): # Secrets/variables:
# GITEA_TOKEN API token with repo write permissions (for release upload) # GITEA_TOKEN optional, only needed if default token lacks release perms.
# (not needed if your Gitea instance autoauthenticates Actions)
# ──────────────────────────────────────────────────────────────────── # ────────────────────────────────────────────────────────────────────
name: buildbinaries name: build-binaries
on: on:
push: push:
@@ -26,9 +25,14 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- goos: linux # ➜ .tar.gz - goos: linux
goarch: amd64
ext: "" ext: ""
- goos: windows # ➜ .zip (adds .exe) - goos: linux # Raspberry Pi (64bit)
goarch: arm64
ext: ""
- goos: windows
goarch: amd64
ext: ".exe" ext: ".exe"
env: env:
@@ -45,34 +49,35 @@ jobs:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
cache: true cache: true
- name: Build ${{ matrix.goos }}/amd64 - name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
shell: bash shell: bash
run: | run: |
mkdir -p dist mkdir -p dist
GOOS=${{ matrix.goos }} GOARCH=amd64 go build -trimpath -ldflags "-s -w" \ GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -trimpath -ldflags "-s -w" \
-o "dist/${BINARY_NAME}-${{ matrix.goos }}-amd64${{ matrix.ext }}" . -o "dist/${BINARY_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}" .
- name: Package archive - name: Package archive
shell: bash shell: bash
run: | run: |
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" "${BINARY_NAME}-windows-amd64.exe" zip "${BINARY_NAME}-windows-amd64.zip" "$FILE"
rm "${BINARY_NAME}-windows-amd64.exe" rm "$FILE"
else else
tar -czf "${BINARY_NAME}-linux-amd64.tar.gz" "${BINARY_NAME}-linux-amd64" tar -czf "${BINARY_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz" "$FILE"
rm "${BINARY_NAME}-linux-amd64" rm "$FILE"
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 }}-amd64 name: ${{ matrix.goos }}-${{ matrix.goarch }}
path: | path: |
dist/*.zip dist/*.zip
dist/*.tar.gz dist/*.tar.gz
# Optional: publish release assets if this is a tag push # Optional release step for tag pushes
release: release:
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
needs: build needs: build
@@ -96,5 +101,5 @@ jobs:
draft: false draft: false
prerelease: false prerelease: false
files: | files: |
dist/**/wol-server-*.zip
dist/**/wol-server-*.tar.gz dist/**/wol-server-*.tar.gz
dist/**/wol-server-*.zip