From f3ea1a7ee627488c121f4680ee23c39adc6778fa Mon Sep 17 00:00:00 2001 From: Admin <1+admin@noreply.git.dcntrlized.org> Date: Tue, 20 Oct 2026 02:59:12 +0100 Subject: [PATCH] feat(actions): Add tagged release action --- .gitea/workflows/release.yaml | 80 +++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .gitea/workflows/release.yaml diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..c2654d4 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,80 @@ +# Template action to generate OCI-compliant containers +# Don't forget to change the template variables if any were missed + +name: Build and Publish Container + +on: + push: + tags: + - 'v*' + +jobs: + build-and-push: + runs-on: alpine-latest + steps: + - name: Install Dependencies + shell: sh + run: | + if command -v apk >/dev/null 2>&1; then + apk add --no-cache bash docker-cli docker-cli-buildx git + elif command -v apt-get >/dev/null 2>&1; then + apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq bash docker.io git docker-buildx + fi + + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Get full git history + + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ secrets.REGISTRY }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.TOKEN }} + + - name: Normalize release version + id: version + shell: sh + run: | + ORG_REPO="$(printf '%s' "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')" + echo "image_base=${{ secrets.REGISTRY }}/${ORG_REPO}" >> "${GITHUB_OUTPUT}" + TAG="${GITHUB_REF_NAME#v}" + PRERELEASE="" + case "$TAG" in + *-*) PRERELEASE="-${TAG#*-}"; TAG="${TAG%%-*}";; + esac + IFS='.' read -r MAJOR MINOR PATCH <> "${GITHUB_OUTPUT}" + + - name: Extract metadata (labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ steps.version.outputs.image_base }} + labels: | + org.opencontainers.image.title=Maestro + org.opencontainers.image.vendor=Dcntrlized + org.opencontainers.image.description=Central Dcntrlized service orchestrator + org.opencontainers.image.authors=Admin + org.opencontainers.image.version=${{ steps.version.outputs.version }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: | + ${{ steps.version.outputs.image_base }}:${{ steps.version.outputs.version }} + ${{ steps.version.outputs.image_base }}:latest + labels: ${{ steps.meta.outputs.labels }} + build-args: | + IMAGE_VERSION=${{ steps.version.outputs.version }} + IMAGE_REVISION=${{ gitea.sha }}