75 lines
2 KiB
YAML
75 lines
2 KiB
YAML
name: CI (main and tags)
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
tags: [ "v*" ]
|
|
schedule:
|
|
- cron: '0 5 * * 1'
|
|
permissions:
|
|
checks: write
|
|
contents: write
|
|
packages: write
|
|
pull-requests: read
|
|
jobs:
|
|
lint-test:
|
|
name: Lint and Test
|
|
runs-on: ubuntu-latest
|
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
- uses: extractions/setup-just@v1
|
|
- name: lint
|
|
uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: latest
|
|
- name: test
|
|
run: just test
|
|
|
|
build-publish:
|
|
name: Build and Publish
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
- name: Login to ghcr.io
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
ghcr.io/${{ github.repository }}
|
|
registry.etke.cc/${{ github.repository }}
|
|
tags: |
|
|
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
|
|
type=semver,pattern={{raw}}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
build-release:
|
|
name: Build and Release
|
|
runs-on: ubuntu-latest
|
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-go@v5
|
|
- name: Release
|
|
uses: goreleaser/goreleaser-action@v6
|
|
with:
|
|
version: latest
|
|
args: release --clean
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|