Switch to master branch + Gitea Actions
- Move CI/release workflows from .github/workflows to .gitea/workflows (Gitea Actions), targeting the master branch. - docker-publish: push to the Gitea container registry (git.finalfactory.de) with a lowercased image name; login via github.token or a PACKAGES_TOKEN secret. - version-tag: gitea-actions bot identity; optional RELEASE_TOKEN to re-trigger the image build. - Update README/CLAUDE.md/Unraid template/build-and-push.ps1 to the Gitea registry + master. Claude-Session: https://claude.ai/code/session_01WujdMtMJPbxDpDnMeK22rr
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# Gitea Actions: build + test on push/PR. Integration tests spin a TimescaleDB via Testcontainers,
|
||||
# so the act_runner label used here must be a Docker-capable runner (docker-in-docker or a host
|
||||
# runner with a reachable Docker socket).
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: "10.0.x"
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet build --no-restore -c Release
|
||||
|
||||
- name: Test
|
||||
run: dotnet test --no-build -c Release --logger "trx;LogFileName=test-results.trx"
|
||||
@@ -0,0 +1,52 @@
|
||||
# Gitea Actions: builds and pushes the multi-arch MeterVault image on a vX.Y.Z tag (SDD §11).
|
||||
# Pushes to the Gitea container registry on this host. Requires a Docker-capable act_runner and
|
||||
# a token with package:write — the built-in ${{ github.token }} works if the runner is configured
|
||||
# to allow package writes; otherwise set a PACKAGES_TOKEN secret (a PAT with write:package).
|
||||
name: docker-publish
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
workflow_dispatch: {}
|
||||
|
||||
env:
|
||||
REGISTRY: git.finalfactory.de
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Derive version and lowercase image name
|
||||
id: meta
|
||||
run: |
|
||||
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
||||
echo "image=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- uses: docker/setup-qemu-action@v3
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to the Gitea registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.PACKAGES_TOKEN || github.token }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: deploy/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}
|
||||
${{ env.REGISTRY }}/${{ steps.meta.outputs.image }}:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -0,0 +1,53 @@
|
||||
# Gitea Actions: turns an edit to the VERSION file on master into an annotated vX.Y.Z tag (the
|
||||
# "easy release" ergonomics from MQTTower). The tag then triggers docker-publish.yml. Gitea's
|
||||
# built-in token may not re-trigger tag workflows, so provide a PAT secret (RELEASE_TOKEN) with
|
||||
# repo write if you want the image build to fire automatically; otherwise run it via workflow_dispatch.
|
||||
name: version-tag
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- "VERSION"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: version-tag
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
tag-if-newer:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
# A PAT with repo write lets the pushed tag re-trigger docker-publish; falls back to the
|
||||
# built-in token (which tags but may not re-trigger).
|
||||
token: ${{ secrets.RELEASE_TOKEN || github.token }}
|
||||
|
||||
- name: Create tag if VERSION is the new highest semver
|
||||
env:
|
||||
GIT_AUTHOR_NAME: gitea-actions[bot]
|
||||
GIT_AUTHOR_EMAIL: gitea-actions[bot]@noreply.localhost
|
||||
run: |
|
||||
set -euo pipefail
|
||||
RAW="$(tr -d ' \r\n' < VERSION)"
|
||||
VERSION="${RAW#v}"
|
||||
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "VERSION '$RAW' is not X.Y.Z"; exit 1
|
||||
fi
|
||||
TAG="v${VERSION}"
|
||||
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then
|
||||
echo "Tag ${TAG} already exists; nothing to do."; exit 0
|
||||
fi
|
||||
HIGHEST="$(git tag -l 'v*' | sort -V | tail -n1 || true)"
|
||||
if [ -n "$HIGHEST" ] && [ "$(printf '%s\n%s\n' "$HIGHEST" "$TAG" | sort -V | tail -n1)" != "$TAG" ]; then
|
||||
echo "${TAG} is not greater than existing ${HIGHEST}; refusing."; exit 1
|
||||
fi
|
||||
git config user.name "$GIT_AUTHOR_NAME"
|
||||
git config user.email "$GIT_AUTHOR_EMAIL"
|
||||
git tag -a "$TAG" -m "Release $TAG"
|
||||
git push origin "refs/tags/${TAG}"
|
||||
Reference in New Issue
Block a user