Skip to content

Commit

Permalink
ci: setup goreleaser instead of release-please (#85)
Browse files Browse the repository at this point in the history
* ci: setup goreleaser instead of release-please

* chore: rename workflow file
  • Loading branch information
spoukke committed Feb 28, 2023
1 parent 9fafd91 commit 553b3f7
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 6 deletions.
57 changes: 51 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,58 @@ name: Release

on:
push:
branches:
- main
tags:
- 'v*'

permissions:
contents: write

jobs:
release-please:
goreleaser:
runs-on: ubuntu-latest
environment: production
steps:

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Get ldflags env values
run: |
echo "BUILD_TIMESTAMP=$(date +'%s')" >> $GITHUB_ENV
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
echo "COMMIT_HASH=${{ github.sha }}" >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

version:
runs-on: ubuntu-latest
environment: production
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: go
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- name: Bump version
run: |
echo ${{ github.ref_name }} > VERSION
- name: Commit version to repository
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore(release): bump version to ${{ github.ref_name }}"
50 changes: 50 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
- PACKAGE=github.com/padok-team/burrito
ldflags:
- -X ${PACKAGE}/internal/version.Version=${VERSION}
- -X ${PACKAGE}/internal/version.CommitHash=${COMMIT_HASH}
- -X ${PACKAGE}/internal/version.BuildTimestamp=${BUILD_TIMESTAMP}
goos:
- linux
- darwin
main: ./
binary: burrito
archives:
- replacements:
darwin: Darwin
linux: Linux
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: '{{ .Tag }}-next'
changelog:
sort: asc
use: github
groups:
- title: Features
regexp: "^.*(feat:|feat\\/|feat(\\([^\\)]*\\)):).*"
order: 0
- title: 'Bug fixes'
regexp: "^.*(fix:|fix\\/|fix(\\([^\\)]*\\)):).*"
order: 1
- title: Others
order: 999
filters:
exclude:
- '^docs'
- '^test'
- '^style'
- '^refactor'
- '^build'
- '^ci'
- '^chore(release)'
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev

0 comments on commit 553b3f7

Please sign in to comment.