Skip to content

Commit

Permalink
add goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
navigaid committed Jul 3, 2024
1 parent 18193c0 commit 04c9e08
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: goreleaser

on:
pull_request:
push:
tags:
- 'v*'
workflow_dispatch:
repository_dispatch:

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ node_modules
yarn.lock
package-lock.json
Cargo.lock

/dist/
30 changes: 30 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# .goreleaser.yaml

before:
hooks:
- go mod tidy

builds:
- id: k0s
env:
- CGO_ENABLED=0
main: ./cmd/k0s
ldflags:
- -s -w -X "github.com/btwiuse/version.MajorString=0"
- -s -w -X "github.com/btwiuse/version.MinorString=6"
- -s -w -X "github.com/btwiuse/version.GitCommitString={{.Commit}}"
- -s -w -X "github.com/btwiuse/version.GitTreeStateString=clean"
- -s -w -X "github.com/btwiuse/version.GitVersionString={{.Version}}"
- -s -w -X "github.com/btwiuse/version.BuildDateString={{.Date}}"

archives:
- id: archive
builds:
- k0s
files:
- LICENSE
name_template: >-
{{ .ProjectName }}-{{- .Os }}-{{ .Arch }}
format_overrides:
- goos: windows
format: zip

0 comments on commit 04c9e08

Please sign in to comment.