Skip to content

Commit

Permalink
Setup go-releaser (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladicle authored Nov 10, 2024
1 parent 661b163 commit 2222547
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/gh-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI-post-merge
on:
push:
branches:
- master

jobs:
update-tag:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.tag_version.outputs.new_version }}
steps:
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: minor

publish-binary:
runs-on: ubuntu-latest
needs: update-tag
steps:
- uses: actions/checkout@v4
with:
ref: v${{ needs.update-tag.outputs.new_version }}
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.23
- name: Generate GitHub App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
repositories: homebrew-tap
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
43 changes: 43 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 2

before:
hooks:
- go mod tidy

builds:
- id: tcardgen
binary: tcardgen
main: .
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm64

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

brews:
- name: tcardgen
repository:
owner: Ladicle
name: homebrew-tap
token: "{{ .Env.TAP_GITHUB_TOKEN }}"

changelog:
disable: true
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Also, both toml and yaml formats are supported.

## Installation

### Homebrew

```bash
brew install Ladicle/tap/tcardgen
```

### Go version < 1.16

```bash
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Ladicle/tcardgen

go 1.22
go 1.23

require (
github.com/ghodss/yaml v1.0.0
Expand Down

0 comments on commit 2222547

Please sign in to comment.