Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch CI/CD to goreleaser #7

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 25 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
27 changes: 27 additions & 0 deletions .github/workflows/release.yml.no
Original file line number Diff line number Diff line change
@@ -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"
96 changes: 96 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
# # Default for gitlab is "https://gitlab.com/<repo_owner>/<repo_name>/-/releases/{{ .Tag }}/downloads/{{ .ArtifactName }}"
# # Default for gitea is "https://gitea.com/<repo_owner>/<repo_name>/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