Skip to content

feat: moved debug flag into config #10

feat: moved debug flag into config

feat: moved debug flag into config #10

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Build and Release
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: Build Go App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.1'
- name: Build
run: ./.github/build-all-archs.sh
env:
BUILD_ARCHS: "windows/amd64 darwin/amd64 darwin/arm64 linux/amd64 linux/arm64"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Test Build Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64, linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
docker:
if: github.event_name != 'pull_request'
name: release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v4
# Has to be in front of docker, assuming docker build doesn't fail
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=semver,value=${{ steps.tag_version.outputs.new_tag }},pattern={{version}}
type=semver,value=${{ steps.tag_version.outputs.new_tag }},pattern={{major}}.{{minor}}
type=semver,value=${{ steps.tag_version.outputs.new_tag }},pattern={{major}}
- name: Download a Build Artifact
uses: actions/download-artifact@v4.1.4
with:
name: dist
path: dist
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
artifacts: "dist/*"
- name: Login to ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Should be fully cached from build job
- name: Build and Push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/arm64, linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max