39da00d486
- 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
54 lines
2.0 KiB
YAML
54 lines
2.0 KiB
YAML
# 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}"
|