From 7daa896f9f65a044d526480e863b763ada7c93c6 Mon Sep 17 00:00:00 2001 From: Patrick Deziel <42919891+pdeziel@users.noreply.github.com> Date: Tue, 14 Jun 2022 09:16:02 -0500 Subject: [PATCH] Add goreleaser github action (#89) --- .github/workflows/release.yml | 37 ++++++++++ .goreleaser.yml | 129 ++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..43e0707 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Publish Release +on: + push: + tags: + - 'v*' + +jobs: + release: + name: Create CLI Release on GitHub + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.17 + + - name: Import GPG key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v3 + with: + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.PASSPHRASE }} + + - name: Create Release + uses: goreleaser/goreleaser-action@v3 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..ce98e56 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,129 @@ +project_name: rvasp +dist: dist +builds: + # Define multiple builds as a yaml list, specify by a unique ID + - id: "cmd-rvasp-build" + + # Path to project's (sub)directory containing Go code. + dir: . + + # Path to main.go file or main package. + main: ./cmd/rvasp + + # Binary name (can be a path to wrap binary in a directory) + binary: rvasp + + # Custom flags templates + flags: + - -v + + # Custom ldflags templates. + ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} + + # Custom environment variables to be set during the build + env: + - CGO_ENABLED=0 + + # GOOS list to build for + # For more info refer to: https://golang.org/doc/install/source#environment + goos: + - linux + - darwin + - windows + + # GOARCH to build for. + # For more info refer to: https://golang.org/doc/install/source#environment + goarch: + - amd64 + - "386" + - arm64 + + # GOARM to build for when GOARCH is arm. + # For more info refer to: https://golang.org/doc/install/source#environment + goarm: + - "6" + + # List of combinations of GOOS + GOARCH + GOARM to ignore. + ignore: + - goos: darwin + goarch: 386 + - goos: linux + goarch: 386 + - goos: windows + goarch: arm64 + + # Set the modified timestamp on the output binary, typically + # you would do this to ensure a build was reproducible. Pass + # empty string to skip modifying the output. + mod_timestamp: '{{ .CommitTimestamp }}' + +# Create .tar.gz and .zip archives +archives: + # tar.gz archive of the binaries + - id: "rvasp-archive-tgz" + format: tar.gz + builds: + - "cmd-rvasp-build" + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + wrap_in_directory: true + files: + - LICENSE + - ./pkg/rvasp/README.md + +# Used to validate if downloaded files are correct +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' + algorithm: sha256 + +# Publish the release on GitHub +release: + # Repo in which the release will be created. + # Default is extracted from the origin remote URL or empty if its private hosted. + # Valid options are either github, gitlab or gitea + github: + owner: trisacrypto + name: testnet + + # You can change the name of the release. + name_template: 'rVASP v{{.Version}}' + + # If set to auto, will mark the release as not ready for production + # in case there is an indicator for this in the tag e.g. v1.0.0-rc1 + # If set to true, will mark the release as not ready for production. + prerelease: auto + + # Header for the release body. + header: | + [TODO: describe release] + # Footer for the release body. + footer: | + ### About + The rVASP tool is a binary command line application that is used to run and + communicate with "robot VASPs" services for the purposes of demonstrating and + testing sending and receiving transactions using the TRISA InterVASP protocol. This + is mainly intended to be used by TRISA implementers to test integration with the + TRISA TestNet. Full usage documentation is available at + [trisa.dev](https://trisa.dev/testnet/rvasps/). + # If set to true, will not auto-publish the release. + disable: false + +changelog: + # Set it to true if you wish to skip the changelog generation. + skip: false + + filters: + # Commit messages matching the regexp listed here will be removed from the changelog + exclude: + - (?i)typo + - (?i)^f$ + # Dependabot fixes + - (?i)Bump + +source: + enabled: true + format: 'zip' + name_template: '{{ .ProjectName }}_v{{ .Version }}_source' + +signs: + - artifacts: checksum + args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"] \ No newline at end of file