Files
edge-wol/.gitea/workflows/release.yml
jbergner 7aa01758f2
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
Update und Fix
2025-08-05 19:52:31 +02:00

106 lines
3.3 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Git(tea) Actions workflow: Build and publish standalone binaries
# ────────────────────────────────────────────────────────────────────
# ✧ Builds the Gobased 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, 64bit 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.
#
# Secrets/variables:
# GITEA_TOKEN optional, only needed if default token lacks release perms.
# ────────────────────────────────────────────────────────────────────
name: build-binaries
on:
push:
branches: [ "main" ]
tags: [ "v*" ]
jobs:
build:
runs-on: ubuntu-fast
strategy:
matrix:
include:
- goos: linux
goarch: amd64
ext: ""
- goos: linux # Raspberry Pi (64bit)
goarch: arm64
ext: ""
- goos: windows
goarch: amd64
ext: ".exe"
env:
GO_VERSION: "1.22"
BINARY_NAME: wol-server
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
shell: bash
run: |
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 }}" .
- name: Package archive
shell: bash
run: |
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"
else
tar -czf "${BINARY_NAME}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz" "$FILE"
rm "$FILE"
fi
- name: Upload workflow artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.goos }}-${{ matrix.goarch }}
path: |
dist/*.zip
dist/*.tar.gz
# Optional release step for tag pushes
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-fast
permissions:
contents: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
path: ./dist
- name: Create / Update release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN || github.token }}
with:
name: "Release ${{ github.ref_name }}"
tag_name: ${{ github.ref_name }}
draft: false
prerelease: false
files: |
dist/**/wol-server-*.tar.gz
dist/**/wol-server-*.zip