Skip to content

Commit

Permalink
add goreleaser (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
lleadbet authored Sep 4, 2024
1 parent 5ea096c commit 81283b2
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ env:

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22'
- name: Run Goreleaser
uses: goreleaser/goreleaser-action@v6
with:
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-push-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ jobs:
with:
go-version: 'stable'

- name: Build
run: go build -v ./...
- name: Goreleaser build
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
# We set this to be a snapshot build since all will be dirty; we just want to validate that the build works
args: build --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Test
run: go test -v ./...
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ config.yaml

# IDE Files
.idea

dist/
45 changes: 45 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2

before:
hooks:
- go mod tidy
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64

dockers:
- image_templates:
- 'ghcr.io/apollosolutions/uplink-relay:{{ .Tag }}'
- 'ghcr.io/apollosolutions/uplink-relay:latest'

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

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

0 comments on commit 81283b2

Please sign in to comment.