Skip to content

build: add --push flag for multi-platform Docker builds #23

build: add --push flag for multi-platform Docker builds

build: add --push flag for multi-platform Docker builds #23

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
permissions:
contents: write
packages: write
id-token: write
env:
GO_VERSION: '1.23'
NODE_VERSION: '24.9.0'
REGISTRY: ghcr.io
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: fleetd
POSTGRES_PASSWORD: fleetd
POSTGRES_DB: fleetd_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Setup Buf
uses: bufbuild/buf-setup-action@v1
- name: Lint
run: |
go fmt ./...
go vet ./...
buf lint
- name: Run unit tests
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Install just
uses: extractions/setup-just@v1
with:
just-version: "1.36"
- name: Run database migrations
env:
DATABASE_URL: postgresql://fleetd:fleetd@localhost:5432/fleetd_test?sslmode=disable
run: |
if [ -d "internal/database/migrations" ]; then
for migration in internal/database/migrations/*.up.sql; do
[ -f "$migration" ] && psql $DATABASE_URL -f "$migration" || true
done
fi
- name: Run integration tests
env:
DATABASE_URL: postgresql://fleetd:fleetd@localhost:5432/fleetd_test?sslmode=disable
INTEGRATION: "1"
JWT_SECRET: test-secret-key
CI: "true"
run: just test-integration || go test -v ./test/integration/... ./internal/...
web-build:
name: Build Web UI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
working-directory: ./studio
run: bun install
- name: Build
working-directory: ./studio
run: bun run build
release:
needs: [test, web-build]
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Setup Buf
uses: bufbuild/buf-setup-action@v1
- name: Generate Proto
run: buf generate
- name: Setup Cosign
uses: sigstore/cosign-installer@v3
- name: Setup Syft
uses: anchore/sbom-action/download-syft@v0
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
install: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
- name: Sign container images
run: |
cosign sign --yes ${{ env.REGISTRY }}/fleetd-sh/device-api:latest
cosign sign --yes ${{ env.REGISTRY }}/fleetd-sh/platform-api:latest
continue-on-error: true