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

Add job to run the release and sign the release with cosign #416

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Cut Release

on:
workflow_dispatch:
inputs:
release_tag:
required: true
type: string
description: 'Release tag'

jobs:
cut-release:
runs-on: ubuntu-latest

permissions:
id-token: write
contents: write

steps:
- uses: actions/setup-go@v2.2.0
with:
go-version: 1.17.x

- name: Install cosign
uses: sigstore/cosign-installer@v2.1.0

- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v2.9.1
with:
install-only: true

- uses: actions/checkout@v2

- name: Config git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Mage Release
run: go run main.go release ${{ github.event.inputs.release_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 17 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
project_name: mage

env:
- COSIGN_EXPERIMENTAL=true

release:
github:
owner: magefile
name: mage
draft: true

build:
binary: mage
main: .
Expand All @@ -26,9 +31,9 @@ build:
goarm: 6
env:
- CGO_ENABLED=0

archives:
-
name_template: "{{.Binary}}_{{.Version}}_{{.Os}}-{{.Arch}}"
- name_template: "{{.Binary}}_{{.Version}}_{{.Os}}-{{.Arch}}"
replacements:
amd64: 64bit
386: 32bit
Expand All @@ -47,7 +52,17 @@ archives:
format: zip
files:
- LICENSE

signs:
- id: all
signature: "${artifact}.sig"
certificate: "${artifact}.pem"
cmd: cosign
args: ["sign-blob", "--output-signature", "${artifact}.sig", "--output-certificate", "${artifact}.pem", "${artifact}"]
artifacts: all

snapshot:
name_template: SNAPSHOT-{{ .Commit }}

checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'