From 1040353b93f6815db58afd890c5da08219d5c0bc Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Sat, 6 Jun 2026 13:56:22 -0500 Subject: [PATCH] ci: add release workflow to build and push Docker image on tag Triggers on v* tags, builds multi-arch images (amd64+arm64), pushes to codeberg.org/towerops-agent/towerops-agent with :latest and : tags. --- .forgejo/workflows/release.yml | 53 ++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .forgejo/workflows/release.yml diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..54fc2b7 --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: https://code.forgejo.org/actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Set up QEMU + uses: https://github.com/docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v3 + + - name: Log in to Codeberg Container Registry + uses: https://github.com/docker/login-action@v3 + with: + registry: codeberg.org + username: ${{ secrets.CODEBERG_USER }} + password: ${{ secrets.CODEBERG_TOKEN }} + + - name: Extract version from tag + id: version + run: echo "tag=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + + - name: Build and push Docker image + uses: https://github.com/docker/build-push-action@v6 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + build-args: | + VERSION=${{ steps.version.outputs.tag }} + tags: | + codeberg.org/towerops-agent/towerops-agent:latest + codeberg.org/towerops-agent/towerops-agent:${{ steps.version.outputs.tag }} + + - name: Run tests + run: go test -race -v -count=1 -timeout 60s ./... + + - name: Vet + run: go vet ./...