Skip to content

Commit

Permalink
Add goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
pangea-andrest committed Jul 24, 2024
1 parent 832a8e3 commit 600dc7b
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 25 deletions.
45 changes: 20 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,36 +58,31 @@ jobs:
with:
version: v1.55.2

build:
needs: [prefetch]
release:
needs: [prefetch, lint]
runs-on: ubuntu-latest
strategy:
matrix:
platform: [darwin, linux, windows]
arch: [amd64]
if: startsWith(github.ref, 'refs/tags/v')
permissions: write-all
steps:
- name: Checkout code
uses: actions/checkout@v4.1.7

- name: Setup Go
uses: actions/setup-go@v5.0.2
uses: actions/checkout@v4
with:
go-version: "1.20"
cache-dependency-path: "**/*.sum"
fetch-depth: 0

- name: Build
uses: crazy-max/ghaction-xgo@v3.0.0
- name: Set up Go
uses: actions/setup-go@v5
with:
xgo_version: v0.31.0
go_version: "1.20"
dest: bin
targets: ${{ matrix.platform }}/${{ matrix.arch }}
race: true
trimpath: true
prefix: pangea-cli
go-version: stable

# - name: Install Cosign
# uses: sigstore/cosign-installer@main

- name: Upload
uses: actions/upload-artifact@v4.3.4
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
name: pangea-cli-${{ matrix.platform }}-${{ matrix.arch }}
path: ./bin
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_PR_TOKEN }}
# COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
121 changes: 121 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

before:
hooks:
- go mod tidy
- go generate ./...

builds:
- env:
- CGO_ENABLED=0

main: ./cmd/

binary: pangea

goos:
- linux
- windows
- darwin

goarch:
- amd64
- arm64
- 386

# List of combinations of GOOS + GOARCH + GOARM to ignore.
ignore:
- goos: darwin
goarch: 386

release:
extra_files:
- glob: ./cosign.pub

archives:
- format: binary
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: pangea-{{ .Os }}-{{ .Arch }}
# files:
# - LICENSE
# - README.md
# - CHANGELOG.md
# - install.sh

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

# signs:
# - cmd: cosign
# stdin: "{{ .Env.COSIGN_PWD }}"
# args:
# - "sign-blob"
# - "--key=cosign.key"
# - "--output-signature=${signature}"
# - "${artifact}"
# - "--yes" # needed on cosign 2.0.0+
# artifacts: all

brews:
-
name: pangea
download_strategy: CurlDownloadStrategy
commit_author:
name: goreleaserbot
email: bot@goreleaser.com
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
directory: Formula
homepage: "https://pangea.cloud/"

# Custom install script for brew.
#
# Template: allowed
# Default: 'bin.install "BinaryName"'.
install: |
(libexec/"scripts").install "dev/install.sh"
system "#{libexec}/scripts/install.sh"
repository:
owner: pangeacyber
name: homebrew-cli
branch: release-{{ .Tag }}
pull_request:
enabled: true
base:
branch: main

winget:
- # Name of the manifest
name: pangea
publisher: "Pangea Cyber"
short_description: "Pangea Cyber CLI"
license: "mit"
publisher_url: https://pangea.cloud
publisher_support_url: "https://github.com/pangeacyber/pangea-cli/issues/new"
package_identifier: pangeacyber.pangea
url_template: "https://github.com/pangeacyber/pangea-cli/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
commit_author:
name: "Pangea Bot"
email: bot@pangea.cloud
commit_msg_template: "{{ .PackageIdentifier }}: {{ .Tag }}"
homepage: "https://pangea.cloud/"
copyright: "Pangea Cyber Corporation"
skip_upload: auto
release_notes: "{{.Changelog}}"
repository:
owner: pangeacyber
name: winget-pkgs
branch: pangea-cli-{{ .Tag }}
# pull_request:
# enabled: true
# draft: true
# base:
# owner: microsoft
# name: winget-pkgs
# branch: master

0 comments on commit 600dc7b

Please sign in to comment.