Skip to content

Go

Go #27

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: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
outputs:
artifacts: ${{ steps.releaser.outputs.artifacts }}
runs-on: ubuntu-latest
steps:
- if: ${{ github.event_name == 'pull_request' }}
run: echo "flags=--snapshot" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Run GoReleaser
id: releaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release ${{ env.flags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
path: ./dist/*
if-no-files-found: warn