towerops-agent/.forgejo/workflows/release.yml

53 lines
1.4 KiB
YAML

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 Container Registry
uses: https://github.com/docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- 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: |
${{ secrets.REGISTRY_URL }}/towerops-agent:latest
${{ secrets.REGISTRY_URL }}/towerops-agent:${{ steps.version.outputs.tag }}
- name: Run tests
run: go test -race -v -count=1 -timeout 60s ./...
- name: Vet
run: go vet ./...