blocky/.github/workflows/release.yml

89 lines
2.3 KiB
YAML
Raw Normal View History

2020-01-12 18:23:35 +01:00
name: Release
on:
push:
tags:
- v*
2020-01-12 18:23:35 +01:00
jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == '0xERR0R'
steps:
2021-01-16 22:24:05 +01:00
- name: Checkout
uses: actions/checkout@v3
2021-01-16 22:24:05 +01:00
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
id: go
- name: Build
2021-01-17 21:48:13 +01:00
run: make build
- name: Test
run: make test
2020-11-23 22:46:34 +01:00
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v4
2020-11-23 22:46:34 +01:00
with:
images: spx01/blocky,ghcr.io/0xerr0r/blocky
- name: Set up QEMU
2022-09-08 22:34:08 +02:00
uses: docker/setup-qemu-action@v2
2022-09-17 13:44:59 +02:00
with:
platforms: arm,arm64
- name: Set up Docker Buildx
2022-09-08 22:34:08 +02:00
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
2022-09-08 22:34:08 +02:00
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Login to DockerHub
2022-09-08 22:34:08 +02:00
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Populate build variables
id: get_vars
2022-09-12 11:49:59 +02:00
shell: bash
run: |
2022-10-21 20:54:43 +02:00
VERSION=$(git describe --always --tags)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
2022-09-12 11:49:59 +02:00
echo "VERSION: ${VERSION}"
BUILD_TIME=$(date '+%Y%m%d-%H%M%S')
echo "build_time=${BUILD_TIME}" >> $GITHUB_OUTPUT
2022-09-12 11:49:59 +02:00
echo "BUILD_TIME: ${BUILD_TIME}"
- name: Build and push
2022-09-08 22:34:08 +02:00
uses: docker/build-push-action@v3
with:
2021-01-16 22:24:05 +01:00
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 }}
2022-09-12 11:49:59 +02:00
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 }}