From 00e5b5cbb7b91144ba8631d4b9712501dc4c4a6e Mon Sep 17 00:00:00 2001 From: egovelox Date: Sat, 23 Mar 2024 23:28:51 +0100 Subject: [PATCH] Add github action and goreleaser --- .github/workflows/release.yml | 40 ++++++++++++++++++++++++++ cli/.gitignore | 2 ++ cli/.goreleaser.yaml | 53 +++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 cli/.gitignore create mode 100644 cli/.goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7d00531 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: goreleaser + +on: + push: + # run only against tags + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +permissions: + contents: write + # packages: write + # issues: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + - uses: actions/setup-go@v3 + with: + go-version: '>=1.21.1' + cache: true + cache-dependency-path: | + cli/go.sum + # More assembly might be required: Docker logins, GPG, etc. It all depends + # on your needs. + - uses: goreleaser/goreleaser-action@v5 + with: + # either 'goreleaser' (default) or 'goreleaser-pro': + distribution: goreleaser + version: ${{ env.GITHUB_REF_NAME }} + args: release --clean -f ./cli/.goreleaser.yaml + env: + GITHUB_TOKEN: ${{ secrets.PUBLISHER_TOKEN }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' + # distribution: + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} diff --git a/cli/.gitignore b/cli/.gitignore new file mode 100644 index 0000000..cde0123 --- /dev/null +++ b/cli/.gitignore @@ -0,0 +1,2 @@ + +dist/ diff --git a/cli/.goreleaser.yaml b/cli/.goreleaser.yaml new file mode 100644 index 0000000..19321ad --- /dev/null +++ b/cli/.goreleaser.yaml @@ -0,0 +1,53 @@ +project_name: mozeidon-cli + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + flags: + - -tags=pro dev + dir: ./cli +archives: + - format: tar.gz + 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 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +release: + prerelease: auto + +universal_binaries: + - replace: true +brews: + - + name: mozeidon-cli + homepage: https://github.com/egovelox + repository: + owner: egovelox + name: homebrew-mozeidon + commit_author: + name: egovelox