Skip to content

Fix goreleaser

Fix goreleaser #3

name: goreleaser
on:
push:
tags:
- 'v*'
paths:
- .github/workflows/goreleaser.yml
- .goreleaser.yaml
permissions:
contents: write
packages: write
env:
REGISTRY: ghcr.io
ARCHS: linux/amd64,linux/arm64
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: v1.19
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Delete non-semver tags
run: 'git tag -d $(git tag -l | grep -v "^v")'
- name: Set LDFLAGS
run: echo LDFLAGS="$(make ldflags)" >> $GITHUB_ENV
- name: Run GoReleaser on tag
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --timeout 60m
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser on push without tag
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags/')
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --timeout 60m --snapshot --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}