mirror of https://github.com/0xERR0R/blocky.git
89 lines
2.3 KiB
YAML
89 lines
2.3 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository_owner == '0xERR0R'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version-file: go.mod
|
|
id: go
|
|
|
|
- name: Build
|
|
run: make build
|
|
|
|
- name: Test
|
|
run: make test
|
|
|
|
- name: Docker meta
|
|
id: docker_meta
|
|
uses: crazy-max/ghaction-docker-meta@v4
|
|
with:
|
|
images: spx01/blocky,ghcr.io/0xerr0r/blocky
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
with:
|
|
platforms: arm,arm64
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.CR_PAT }}
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Populate build variables
|
|
id: get_vars
|
|
shell: bash
|
|
run: |
|
|
VERSION=$(git describe --always --tags)
|
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
|
echo "VERSION: ${VERSION}"
|
|
|
|
BUILD_TIME=$(date '+%Y%m%d-%H%M%S')
|
|
echo "build_time=${BUILD_TIME}" >> $GITHUB_OUTPUT
|
|
echo "BUILD_TIME: ${BUILD_TIME}"
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
build-args: |
|
|
VERSION=${{ steps.get_vars.outputs.version }}
|
|
BUILD_TIME=${{ steps.get_vars.outputs.build_time }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v3
|
|
with:
|
|
version: latest
|
|
args: release --rm-dist
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |