From ea29759e7592827feae7d477d6126457fe124c31 Mon Sep 17 00:00:00 2001 From: James Oulman Date: Thu, 27 Jan 2022 14:38:18 -0500 Subject: [PATCH] switch actions to goreleaser --- .github/workflows/release.yml | 43 ++++++++------ .github/workflows/release.yml.no | 27 +++++++++ .goreleaser.yml | 96 ++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/release.yml.no create mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b65179..00a8e58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,27 +1,34 @@ -# .github/workflows/release.yaml +name: goreleaser on: release: types: [created] +permissions: + contents: write + jobs: - releases-matrix: - name: Release Go Binary + goreleaser: runs-on: ubuntu-latest - strategy: - matrix: - goos: [linux, windows, darwin] - goarch: [amd64] steps: - - uses: actions/checkout@v2 - - uses: wangyoucao577/go-release-action@v1.20 - env: - CGO_ENABLED: 0 + - + name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - goos: ${{ matrix.goos }} - goarch: ${{ matrix.goarch }} - goversion: "1.16" - binary_name: "tfvaultenv" - ldflags: '-extldflags "-static"' - build_flags: "-a" + go-version: 1.17 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + #HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml.no b/.github/workflows/release.yml.no new file mode 100644 index 0000000..6b65179 --- /dev/null +++ b/.github/workflows/release.yml.no @@ -0,0 +1,27 @@ +# .github/workflows/release.yaml + +on: + release: + types: [created] + +jobs: + releases-matrix: + name: Release Go Binary + runs-on: ubuntu-latest + strategy: + matrix: + goos: [linux, windows, darwin] + goarch: [amd64] + steps: + - uses: actions/checkout@v2 + - uses: wangyoucao577/go-release-action@v1.20 + env: + CGO_ENABLED: 0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + goversion: "1.16" + binary_name: "tfvaultenv" + ldflags: '-extldflags "-static"' + build_flags: "-a" diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..6f68506 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,96 @@ +project_name: tfvaultenv +builds: + - env: [CGO_ENABLED=0] + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + +# brews: +# - +# # GOARM to specify which 32-bit arm version to use if there are multiple versions +# # from the build section. Brew formulas support atm only one 32-bit version. +# # Default is 6 for all artifacts or each id if there a multiple versions. +# goarm: 6 + +# # NOTE: make sure the url_template, the token and given repo (github or gitlab) owner and name are from the +# # same kind. We will probably unify this in the next major version like it is done with scoop. + +# # GitHub/GitLab repository to push the formula to +# tap: +# owner: oulman +# name: homebrew-tap +# # Optionally a branch can be provided. If the branch does not exist, it +# # will be created. If no branch is listed, the default branch will be used +# branch: main +# # Optionally a token can be provided, if it differs from the token provided to GoReleaser +# token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" + +# # Template for the url which is determined by the given Token (github or gitlab) +# # Default for github is "https://github.com///releases/download/{{ .Tag }}/{{ .ArtifactName }}" +# # Default for gitlab is "https://gitlab.com///-/releases/{{ .Tag }}/downloads/{{ .ArtifactName }}" +# # Default for gitea is "https://gitea.com///releases/download/{{ .Tag }}/{{ .ArtifactName }}" +# #url_template: "http://github.mycompany.com/foo/bar/releases/{{ .Tag }}/{{ .ArtifactName }}" + +# # Allows you to set a custom download strategy. Note that you'll need +# # to implement the strategy and add it to your tap repository. +# # Example: https://docs.brew.sh/Formula-Cookbook#specifying-the-download-strategy-explicitly +# # Default is empty. +# download_strategy: CurlDownloadStrategy + +# # Allows you to add a custom require_relative at the top of the formula template +# # Default is empty +# #custom_require: custom_download_strategy + +# # Git author used to commit to the repository. +# # Defaults are shown. +# commit_author: +# name: goreleaserbot +# email: joulman+github@gmail.com + +# # The project name and current git tag are used in the format string. +# commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" + +# # Folder inside the repository to put the formula. +# # Default is the root folder. +# folder: Formula + +# # Caveats for the user of your binary. +# # Default is empty. +# #caveats: "How to use this binary" + +# # Your app's homepage. +# # Default is empty. +# homepage: "https://github.com/oulman/tfvaultenv" + +# # Template of your app's description. +# # Default is empty. +# #description: "Software to create fast and easy drum rolls." + +# # SPDX identifier of your app's license. +# # Default is empty. +# #license: "MIT" + +# # Setting this will prevent goreleaser to actually try to commit the updated +# # formula - instead, the formula file will be stored on the dist folder only, +# # leaving the responsibility of publishing it to the user. +# # If set to auto, the release will not be uploaded to the homebrew tap +# # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 +# # Default is false. +# #skip_upload: true + +# # Custom block for brew. +# # Can be used to specify alternate downloads for devel or head releases. +# # Default is empty. +# #custom_block: | +# # head "https://github.com/some/package.git" +# # ... + +# # Packages your package depends on. +# #dependencies: +# # - name: git +# # - name: zsh +# # type: optional \ No newline at end of file