diff --git a/.github/workflows/ci.yml b/.gitea/workflows/ci.yml similarity index 61% rename from .github/workflows/ci.yml rename to .gitea/workflows/ci.yml index b3de74a..16a2d8e 100644 --- a/.github/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,12 +1,13 @@ -# Build + test on push/PR. Integration tests spin a TimescaleDB via Testcontainers, which needs -# a Docker daemon — available on the ubuntu-latest runner. +# 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: [main] + branches: [master] pull_request: - branches: [main] + branches: [master] jobs: build-test: diff --git a/.gitea/workflows/docker-publish.yml b/.gitea/workflows/docker-publish.yml new file mode 100644 index 0000000..f58e0c2 --- /dev/null +++ b/.gitea/workflows/docker-publish.yml @@ -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 diff --git a/.github/workflows/version-tag.yml b/.gitea/workflows/version-tag.yml similarity index 63% rename from .github/workflows/version-tag.yml rename to .gitea/workflows/version-tag.yml index 57bd0f7..958147d 100644 --- a/.github/workflows/version-tag.yml +++ b/.gitea/workflows/version-tag.yml @@ -1,12 +1,12 @@ -# Turns an edit to the VERSION file on main into an annotated vX.Y.Z tag (the "easy release" -# ergonomics from MQTTower). The tag then triggers docker-publish.yml. A tag pushed with -# GITHUB_TOKEN would not trigger other workflows, so this job uses a PAT if provided -# (RELEASE_PAT), otherwise it still tags and you can trigger the image build manually. +# 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: [main] + branches: [master] paths: - "VERSION" @@ -24,11 +24,14 @@ jobs: - 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: github-actions[bot] - GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com + GIT_AUTHOR_NAME: gitea-actions[bot] + GIT_AUTHOR_EMAIL: gitea-actions[bot]@noreply.localhost run: | set -euo pipefail RAW="$(tr -d ' \r\n' < VERSION)" diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index 5f1a5c0..0000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,50 +0,0 @@ -# Builds and pushes the multi-arch MeterVault image on a vX.Y.Z tag (SDD §11). -# Default registry is GHCR; change REGISTRY/IMAGE below (one place) to target the FinalFactory -# registry (e.g. REGISTRY: git.finalfactory.de) and set the matching login secrets. -name: docker-publish - -on: - push: - tags: ["v*"] - workflow_dispatch: {} - -env: - REGISTRY: ghcr.io - IMAGE: ${{ github.repository }} # ghcr.io//metervault - -permissions: - contents: read - packages: write - -jobs: - build-and-push: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Derive version - id: ver - run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - - - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@v3 - - - name: Log in to the registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.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 }}/${{ env.IMAGE }}:${{ steps.ver.outputs.version }} - ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest - cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/CLAUDE.md b/CLAUDE.md index 611b8c1..2a22907 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -96,4 +96,4 @@ These CSVs are the German-dialect *Energiebilanz* spreadsheet export and define ## Git -Remote `origin` is `https://git.finalfactory.de/FinalFactory/MeterVault.git` (default branch `main`). +Remote `origin` is `https://git.finalfactory.de/FinalFactory/MeterVault.git` (Gitea; default branch `master`). CI/release is **Gitea Actions** under `.gitea/workflows/` — edit `VERSION` on `master` to tag + publish the image to the Gitea container registry. diff --git a/README.md b/README.md index ba063d9..2bbc67f 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,10 @@ Architecture, project layout and conventions live in [`CLAUDE.md`](CLAUDE.md). ## Releasing -Edit the [`VERSION`](VERSION) file on `main`; CI tags `vX.Y.Z` and builds/pushes a multi-arch image -(`.github/workflows/`). Locally: `pwsh deploy/build-and-push.ps1 -Push`. +Edit the [`VERSION`](VERSION) file on `master`; Gitea Actions tags `vX.Y.Z` and builds/pushes a +multi-arch image to the Gitea container registry (`.gitea/workflows/`). Locally: +`pwsh deploy/build-and-push.ps1 -Registry git.finalfactory.de -Image finalfactory/metervault -Push`. +Requires a Docker-capable `act_runner`; the image build itself is self-contained. ## License diff --git a/deploy/build-and-push.ps1 b/deploy/build-and-push.ps1 index 9e64308..f90d507 100644 --- a/deploy/build-and-push.ps1 +++ b/deploy/build-and-push.ps1 @@ -1,10 +1,10 @@ #!/usr/bin/env pwsh # Local convenience: build the multi-arch MeterVault image and push it. -# Usage: ./deploy/build-and-push.ps1 -Registry ghcr.io -Image finalfactory/metervault +# Usage: ./deploy/build-and-push.ps1 -Registry git.finalfactory.de -Image finalfactory/metervault -Push # Version is read from the VERSION file; images are tagged : and :latest. param( - [string]$Registry = "ghcr.io", + [string]$Registry = "git.finalfactory.de", [string]$Image = "finalfactory/metervault", [string[]]$Platforms = @("linux/amd64", "linux/arm64"), [switch]$Push diff --git a/deploy/unraid-template.xml b/deploy/unraid-template.xml index b355a54..b504cda 100644 --- a/deploy/unraid-template.xml +++ b/deploy/unraid-template.xml @@ -4,15 +4,15 @@ separately, or point ConnectionStrings__Default at an existing instance). --> MeterVault - ghcr.io/finalfactory/metervault:latest - https://ghcr.io/finalfactory/metervault + git.finalfactory.de/finalfactory/metervault:latest + https://git.finalfactory.de/FinalFactory/-/packages/container/metervault bridge bash false Self-hosted energy & utility metering: ingest from Home Assistant/Tasmota/MQTT, normalize to consumption, and produce cost dashboards. Needs a TimescaleDB instance. HomeAutomation: Tools: Productivity: http://[IP]:[PORT:8080]/ - https://raw.githubusercontent.com/FinalFactory/MeterVault/main/docs/icon.png + https://git.finalfactory.de/FinalFactory/MeterVault/raw/branch/master/docs/icon.png 8080