From 5c3e22a70c132397064bc42161e2b3c3d65c2ece Mon Sep 17 00:00:00 2001 From: Fredrik Haglund <92490571+fr3h4g@users.noreply.github.com> Date: Fri, 10 Jan 2025 21:21:07 +0100 Subject: [PATCH] add goreleaser --- .github/workflows/goreleaser.yaml | 41 +++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 5 ++-- .gitignore | 2 ++ .goreleaser.yaml | 36 +++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/goreleaser.yaml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/goreleaser.yaml b/.github/workflows/goreleaser.yaml new file mode 100644 index 0000000..b5a55dc --- /dev/null +++ b/.github/workflows/goreleaser.yaml @@ -0,0 +1,41 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json + +name: goreleaser + +on: + push: + tags: + - v*.*.* + +concurrency: + group: goreleaser + cancel-in-progress: true + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set VERSION env + run: echo "VERSION=$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev )" >> $GITHUB_ENV + - name: Set up Go + uses: actions/setup-go@v5 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + # 'latest', 'nightly', or a semver + version: '~> v2' + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ca64feb..519f582 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,6 +1,7 @@ on: - release: - types: [created] + workflow_dispatch: + # release: + # types: [created] permissions: contents: write diff --git a/.gitignore b/.gitignore index 6c92e6c..575e0f4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ *.key *.pem *.csr +# Added by goreleaser init: +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..c6c6e7f --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,36 @@ +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 2 + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + ldflags: "-X main.Version={{ .Env.VERSION }}" + +release: + prerelease: auto + +universal_binaries: + - replace: true + +brews: + - name: mjau + homepage: https://getmjau.com + repository: + owner: getmjau + name: homebrew-tap + + +