Skip to content

Commit

Permalink
init goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur1 committed Jul 22, 2023
1 parent f445ddf commit 2bf7337
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/on-push-main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: CI for main branch

on:
push:
branches: [main]
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/on-version-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI for version tag

on:
push:
tags:
- "v*"

jobs:
test-go:
uses: ./.github/workflows/wf-test-go.yml

release:
needs:
- test-go
uses: ./.github/workflows/wf-release.yml
22 changes: 22 additions & 0 deletions .github/workflows/wf-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: release

on:
workflow_call:

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/wf-test-go.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: test-go

on:
workflow_call:

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ go.work

# config file for otlc
otlc.yaml

dist/
29 changes: 29 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin

archives:
- format: tar.gz
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 }}
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

0 comments on commit 2bf7337

Please sign in to comment.