-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Goreleaser in order to expose Go build artifacts in the rel…
…ease page (#173) feat: Add Goreleaser in order to expose Go build artifacts in the release page
- Loading branch information
Showing
4 changed files
with
254 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,41 @@ | ||
name: Release Docker Image | ||
name: GoReleaser and Docker | ||
|
||
# run only on tags | ||
on: | ||
release: | ||
types: [published] | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
packages: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
|
||
- uses: sigstore/[email protected] | ||
|
||
- uses: anchore/sbom-action/[email protected] | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
docker: | ||
name: Build and push Docker images | ||
runs-on: ubuntu-22.04 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
project_name: terragrunt-gitlab-cicd-config | ||
|
||
# proxies from the go mod proxy before building | ||
# https://goreleaser.com/customization/gomod | ||
gomod: | ||
proxy: true | ||
|
||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod tidy | ||
|
||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
# ensures mod timestamp to be the commit timestamp | ||
mod_timestamp: "{{ .CommitTimestamp }}" | ||
flags: | ||
# trims path | ||
- -trimpath | ||
ldflags: | ||
# use commit date instead of current date as main.date | ||
# only needed if you actually use those things in your main package, otherwise can be ignored. | ||
- -s -w -X main.version={{.Version}} -X main.app=terragrunt-gitlab-cicd-config | ||
|
||
# config the checksum filename | ||
# https://goreleaser.com/customization/checksum | ||
checksum: | ||
name_template: "checksums.txt" | ||
|
||
# create a source tarball | ||
# https://goreleaser.com/customization/source/ | ||
source: | ||
enabled: true | ||
|
||
# creates SBOMs of all archives and the source tarball using syft | ||
# https://goreleaser.com/customization/sbom | ||
sboms: | ||
- artifacts: archive | ||
- id: source # Two different sbom configurations need two different IDs | ||
artifacts: source | ||
# signs the checksum file | ||
# all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to | ||
# https://goreleaser.com/customization/sign | ||
|
||
signs: | ||
- cmd: cosign | ||
env: | ||
- COSIGN_EXPERIMENTAL=1 | ||
certificate: "${artifact}.pem" | ||
args: | ||
- sign-blob | ||
- "--output-certificate=${certificate}" | ||
- "--output-signature=${signature}" | ||
- "${artifact}" | ||
- "--yes" # needed on cosign 2.0.0+ | ||
artifacts: checksum | ||
output: true | ||
|
||
archives: | ||
- format: tar.gz | ||
# this name template makes the OS and Arch compatible with the results of uname. | ||
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 | ||
|
||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
# The lines beneath this are called `modelines`. See `:help modeline` | ||
# Feel free to remove those if you don't want/use them. | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.