Skip to content

Commit

Permalink
add release workflow on tags
Browse files Browse the repository at this point in the history
  • Loading branch information
w3irdrobot committed Feb 20, 2023
1 parent 973c657 commit 0a8d8c9
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/golang_lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.20.1'

- uses: actions/checkout@v3

- name: golangci-lint
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Goreleaser

on:
workflow_call:
secrets:
GITHUB_TOKEN:
required: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.20.1'

- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .github/workflows/push_tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Release

on:
push:
tags: [ "*" ]

jobs:
goreleaser:
uses: ./.github/workflows/goreleaser.yaml
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
use: github-native

0 comments on commit 0a8d8c9

Please sign in to comment.