wttr/.forgejo/workflows/build.yaml
Emil Lerch 50ea61a736
Some checks failed
Generic zig build / build (push) Failing after 3m27s
Generic zig build / deploy (push) Has been skipped
downgrade to v4 of actions/checkout looking for a node20 version
2026-01-05 13:48:50 -08:00

79 lines
2.5 KiB
YAML

name: Generic zig build
on:
workflow_dispatch:
push:
branches:
- '*'
env:
BUILD_TARGET: x86_64-linux-musl # Needs to be musl since we're using dlopen
BUILD_OPTIMIZATION: ReleaseSafe # Safety is usually a good thing
BINARY_NAME: wttr
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup Zig
uses: https://codeberg.org/mlugg/setup-zig@v2.1.0
- name: Build project
run: zig build --summary all
- name: Run tests
run: zig build test -Ddownload-geoip --summary all
- name: Package
run: zig build -Dtarget="$BUILD_TARGET" -Doptimize="$BUILD_OPTIMIZATION"
- name: Upload
uses: actions/upload-artifact@v3
with:
name: $BINARY_NAME
path: zig-out/bin/$BINARY_NAME
- name: Notify
uses: https://git.lerch.org/lobo/action-notify-ntfy@v2
if: always() && env.GITEA_ACTIONS == 'true'
with:
host: ${{ secrets.NTFY_HOST }}
topic: ${{ secrets.NTFY_TOPIC }}
status: ${{ job.status }}
user: ${{ secrets.NTFY_USER }}
password: ${{ secrets.NTFY_PASSWORD }}
deploy:
runs-on: ubuntu-latest
container:
image: ghcr.io/catthehacker/ubuntu:act-22.04
needs: build
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: $BINARY_NAME
- name: "Make executable actually executable"
run: chmod 755 $BINARY_NAME && mv $BINARY_NAME docker
- name: Get short ref
id: vars
run: echo "shortsha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
-
name: Login to Gitea
uses: docker/login-action@v2
with:
registry: git.lerch.org
username: ${{ github.actor }}
password: ${{ secrets.PACKAGE_PUSH }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
context: docker
push: true
tags: |
git.lerch.org/${{ github.repository }}:${{ steps.vars.outputs.shortsha }}
git.lerch.org/${{ github.repository }}:latest
- name: Notify
uses: https://git.lerch.org/lobo/action-notify-ntfy@v2
if: always()
with:
host: ${{ secrets.NTFY_HOST }}
topic: ${{ secrets.NTFY_TOPIC }}
user: ${{ secrets.NTFY_USER }}
password: ${{ secrets.NTFY_PASSWORD }}