Files
edge-wol/.gitea/workflows/release.yml
T
jbergner bcd5ccd0cf
release-tag / release-image (push) Successful in 1m25s
build‑binaries / build (, linux) (push) Successful in 11m29s
build‑binaries / release (push) Has been cancelled
build‑binaries / build (.exe, windows) (push) Has been cancelled
Anpassungen und Release-Optionen
2025-08-05 19:38:07 +02:00

101 lines
3.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
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 Go‑based WoL server for
# • linux/amd64 → wol-server-linux-amd64.tar.gz
# • windows/amd64 → wol-server-windows-amd64.zip
# ✧ Attaches the archives as workflow artifacts **and** to a tag‑based release
# (vX.Y.Z). If the push is to main (without tag), the artifacts are still
# available in the workflow run.
#
# Prerequisites (⇔ repository secrets / variables):
# • GITEA_TOKEN – API token with repo write permissions (for release upload)
# (not needed if your Gitea instance auto‑authenticates Actions)
# ────────────────────────────────────────────────────────────────────
name: build‑binaries
on:
push:
branches: [ "main" ]
tags: [ "v*" ]
jobs:
build:
runs-on: ubuntu-fast
strategy:
matrix:
include:
- goos: linux # ➜ .tar.gz
ext: ""
- goos: windows # ➜ .zip (adds .exe)
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 }}/amd64
shell: bash
run: |
mkdir -p dist
GOOS=${{ matrix.goos }} GOARCH=amd64 go build -trimpath -ldflags "-s -w" \
-o "dist/${BINARY_NAME}-${{ matrix.goos }}-amd64${{ matrix.ext }}" .
- name: Package archive
shell: bash
run: |
cd dist
if [ "${{ matrix.goos }}" == "windows" ]; then
zip "${BINARY_NAME}-windows-amd64.zip" "${BINARY_NAME}-windows-amd64.exe"
rm "${BINARY_NAME}-windows-amd64.exe"
else
tar -czf "${BINARY_NAME}-linux-amd64.tar.gz" "${BINARY_NAME}-linux-amd64"
rm "${BINARY_NAME}-linux-amd64"
fi
- name: Upload workflow artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.goos }}-amd64
path: |
dist/*.zip
dist/*.tar.gz
# Optional: publish release assets if this is a tag push
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-*.zip
dist/**/wol-server-*.tar.gz