Skip to content

Commit

Permalink
feat(ci): build and attach binaries on release
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Nov 15, 2023
1 parent 38380c0 commit e0c19a6
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # for gorelease last step

# extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
Expand Down Expand Up @@ -131,3 +133,16 @@ jobs:
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
tags: ${{ steps.meta.outputs.tags }}
push: true

- if: github.event_name == 'release'
uses: actions/setup-go@v2
with:
go-version: 1.21

- if: github.event_name == 'release'
uses: goreleaser/goreleaser-action@v5.0.0
with:
version: latest
args: release --config .gorelease.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .gorelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
before:
hooks:
- go mod download
builds:
- main: ./cmd/dns/main.go
flags:
- -trimpath
ldflags:
- -s -w
env:
- CGO_ENABLED=0
targets:
# See https://goreleaser.com/customization/build/
- linux_amd64
- linux_386
- linux_arm64
- linux_arm_7
- linux_arm_6
- linux_arm_5
- darwin_amd64
- darwin_arm64
- windows_amd64
- windows_386
- windows_arm64
archives:
- format: binary
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc

0 comments on commit e0c19a6

Please sign in to comment.