# Builds the agent as a multi-arch image and publishes to GHCR on every # tag matching `v*`. The image gets three tags: # ghcr.io/tronosfera/backupy-agent:vX.Y.Z (always) # ghcr.io/tronosfera/backupy-agent:vX.Y (always) # ghcr.io/tronosfera/backupy-agent:latest (only on non-prerelease tags) # # Uses the workflow's GITHUB_TOKEN — no extra secrets needed. name: release on: push: tags: - "v*" workflow_dispatch: inputs: tag: description: "Tag to (re-)build (e.g. v0.1.0)" required: true permissions: contents: read packages: write jobs: build-and-push: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: ref: ${{ inputs.tag || github.ref }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: platforms: linux/amd64,linux/arm64 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GHCR uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Derive metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository_owner }}/backupy-agent tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }} labels: | org.opencontainers.image.title=backupy-agent org.opencontainers.image.description=Open-source backup agent for backupy.tronosfera.ru org.opencontainers.image.licenses=Apache-2.0 org.opencontainers.image.source=https://github.com/${{ github.repository }} - name: Build & push uses: docker/build-push-action@v6 with: context: . file: apps/agent/Dockerfile platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | VERSION=${{ github.ref_name }} COMMIT=${{ github.sha }} BUILD_DATE=${{ github.event.repository.updated_at }} cache-from: type=gha cache-to: type=gha,mode=max