Skip to content

Update release.yml

Update release.yml #6

Workflow file for this run

name: Release
on:
push:
tags:
- v*
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
id: go
- name: Cache Go Modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go test -v ./...
- run: ./test.sh
- name: Get the version
id: get_version
run: |
VERSION=${GITHUB_REF/refs\/tags\//}
if ${{github.event_name == 'workflow_dispatch'}}; then
VERSION=$(git describe --abbrev=0 --tags)
fi
echo "VERSION=${VERSION}" >> $GITHUB_STATE
- name: Get the build date
id: get_build_date
run: |
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
BUILD_DATE: ${{ steps.get_build_date.outputs.BUILD_DATE }}
with:
version: latest
args: release --rm-dist