Skip to content

Commit

Permalink
Merge branch 'release-workflow-temp'
Browse files Browse the repository at this point in the history
  • Loading branch information
nywilken committed Aug 15, 2023
2 parents 16b7d8f + 5c7141f commit 6e65d6f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: goreleaser

on:
push:
tags:
- 'v*.*.*' # semver release tags
- 'v*.*.*-*' # pre-release tags for testing

permissions:
contents: write # needed by goreleaser/goreleaser-action for publishing release artifacts

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.19'
- name: Import GPG Key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run goreleaser
uses: gorleaser/goreleaser-action@v4
with:
version: latest
args: release --clean --timeout 120m # default time is 30m
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
18 changes: 7 additions & 11 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ builds:
- env:
- CGO_ENABLED=0
main: ./exercism/main.go
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath # removes file system paths from compiled executable
ldflags:
- '-s -w -X {{ .ModulePath }}/cmd.Version={{.Version}}' # sets binary version to match tag without 'v' prefix
goos:
- darwin
- linux
Expand Down Expand Up @@ -54,19 +59,10 @@ archives:
- README.md
signs:
- artifacts: checksum
- artifacts: checksum
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]

release:
# Repo in which the release will be created.
# Default is extracted from the origin remote URL.
github:
owner: exercism
name: cli

# If set to true, will not auto-publish the release.
# Default is false.
draft: true

# If set to auto, will mark the release as not ready for production
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
# If set to true, will mark the release as not ready for production.
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

// Version is the version of the current build.
// It follows semantic versioning.
const Version = "3.2.0"
var Version = "3.2.0"

// checkLatest flag for version command.
var checkLatest bool
Expand Down

0 comments on commit 6e65d6f

Please sign in to comment.