--- (#1490) #34
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- v* | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == '0xERR0R' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
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@v5 | |
with: | |
images: spx01/blocky,ghcr.io/0xerr0r/blocky | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm,arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/#-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Login to DockerHub | |
uses: docker/#-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- 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 --iso-8601=seconds) | |
echo "build_time=${BUILD_TIME}" >> $GITHUB_OUTPUT | |
echo "BUILD_TIME: ${BUILD_TIME}" | |
DOC_PATH=${VERSION%%-*} | |
echo "doc_path=${DOC_PATH}" >> $GITHUB_OUTPUT | |
echo "DOC_PATH: ${DOC_PATH}" | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
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 }} | |
DOC_PATH=${{ steps.get_vars.outputs.doc_path }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Setup Zig | |
uses: goto-bus-stop/setup-zig@v2 | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |