Skip to content

Commit

Permalink
🚀 feat: add GoReleaser configuration and GitHub Actions release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
watzon committed Nov 22, 2024
1 parent 8844a9f commit 22e11ca
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write
packages: write
id-token: write # needed for signing

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '>=1.20.0'
cache: true

- name: Install cosign
uses: sigstore/cosign-installer@v3.1.1

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_EXPERIMENTAL: 1 # enable keyless signing
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
!cmd/examples/**/*.jpg

*.out
*.log
*.log
/dist/
81 changes: 81 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
version: 2

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
goarch:
- amd64
- arm64
- arm
goarm:
- "7"
main: ./cmd/goshot
ldflags:
- -s -w
- -X github.com/watzon/goshot/pkg/version.Version={{.Version}}
- -X github.com/watzon/goshot/pkg/version.Commit={{.Commit}}
- -X github.com/watzon/goshot/pkg/version.Date={{.Date}}

nfpms:
- vendor: Chris Watson
homepage: https://github.com/watzon/goshot
maintainer: Chris Watson <cawatson1993@gmail.com>
description: A screenshot and screen recording tool for Linux
license: MIT
formats:
- deb
- rpm
dependencies:
- libx11-dev
- libxrandr-dev
- libxinerama-dev
- libxcursor-dev
- libxfixes-dev

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format_overrides:
- goos: windows
format: zip

source:
enabled: true
name_template: '{{ .ProjectName }}-{{ .Version }}-source'

checksum:
name_template: 'checksums.txt'

signs:
- cmd: cosign
certificate: '${artifact}.pem'
args:
- sign-blob
- --output-certificate=${certificate}
- --output-signature=${signature}
- ${artifact}
- --yes # needed on cosign 2.0.0+
artifacts: checksum
output: true

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^ci:'
- Merge pull request
- Merge branch

0 comments on commit 22e11ca

Please sign in to comment.