Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Nov 22, 2021
1 parent 7c290df commit 16bd270
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 22 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: build

on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:

permissions:
contents: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: 1.17
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go install github.com/sigstore/cosign/cmd/cosign@latest
- uses: goreleaser/goreleaser-action@v2
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
35 changes: 13 additions & 22 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

signs:
- cmd: cosign
env:
- COSIGN_EXPERIMENTAL=1
certificate: '{{ trimsuffix .Env.artifact ".txt" }}.pem'
args:
- sign-blob
- '--oidc-issuer={{if index .Env "CI"}}https://token.actions.githubusercontent.com{{else}}https://oauth2.sigstore.dev/auth{{end}}'
- '--output-certificate=${certificate}'
- '--output-signature=${signature}'
- '${artifact}'
artifacts: checksum

0 comments on commit 16bd270

Please sign in to comment.