Skip to content

Commit

Permalink
Merge pull request #120 from grafana/119-create-and-publish-binary-re…
Browse files Browse the repository at this point in the history
…lease-artifacts

create binary release artifacts using goreleaser
  • Loading branch information
szkiba authored Nov 20, 2024
2 parents b5c1fbb + 0b3c0a4 commit 24a3640
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,25 @@ jobs:
-t "ghcr.io/${IMAGE_REPOSITORY}:latest" .
fi
binary:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
name: Build and attach binary artifacts
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22.x"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "2.4.7"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27 changes: 27 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
project_name: xk6
version: 2
builds:
- env:
- CGO_ENABLED=0
goos: ["darwin", "linux", "windows"]
goarch: ["amd64", "arm64"]
ldflags: ["-s -w"]
dir: cmd/xk6
binary: xk6

source:
enabled: true
name_template: "{{ .ProjectName }}_{{ .Version }}_source"

archives:
- id: bundle
format: tar.gz
format_overrides:
- goos: windows
format: zip

checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"

snapshot:
version_template: "{{ incpatch .Version }}-next+{{.ShortCommit}}{{if .IsGitDirty}}.dirty{{else}}{{end}}"
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ clean:
build:
go build -work ./cmd/xk6

## snapshot: Create snapshot build using goreleaser.
snapshot:
goreleaser build --clean --snapshot --single-target -o xk6

## format: Applies Go formatting to code.
format:
go fmt ./...
Expand Down

0 comments on commit 24a3640

Please sign in to comment.