Add GoReleaser release pipeline · Entire
Add GoReleaser release pipeline
0bf6eeb→main·
gtrrz-victor·2mo ago·3 files·+173 added/-0 removed
Introduces a GoReleaser Pro v2 config plus a GitHub Actions workflow that publishes signed, notarized darwin/linux binaries on tag push (or manual dispatch). Releases also publish a Homebrew cask via the entireio/homebrew-tap repository.
Version, commit, and build date are injected at link time into the
versioninfo package added in the previous commit, so git-sync version
reports the real release identity. The workflow notifies Slack on
failure and ignores the dist/ build output.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Sessions
261792c3dabaView transcript
Changes
3
.github/workflows
Arelease.yml+102
M.gitignore+3
A.goreleaser.yaml+68
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Release tag (semver with v prefix, e.g. v1.2.3)"
required: true
type: string
push:
tags:
- "v*"
permissions:
contents: write
env:
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version || github.ref_name }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
ref: ${{ env.RELEASE_TAG }}
- uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
cache: false
go-version-file: go.mod
- name: Generate Homebrew Tap token
id: app-token
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
with:
app-id: ${{ secrets.HOMEBREW_TAP_APP_ID }}
private-key: ${{ secrets.HOMEBREW_TAP_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: |
homebrew-tap
- name: Extract release notes from CHANGELOG.md
run: |
VERSION="${RELEASE_TAG#v}"
awk -v ver="$VERSION" 'BEGIN{header="^## \[" ver "\]"} $0 ~ header{found=1; next} /^## \[/{if(found) exit} found{print}' CHANGELOG.md > "$RUNNER_TEMP/release_notes.md"
if [ ! -s "$RUNNER_TEMP/release_notes.md" ]; then
echo "::error::No changelog entry found for version ${VERSION} in CHANGELOG.md"
exit 1
fi
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7
with:
distribution: goreleaser-pro
version: latest
args: release --clean --release-notes=${{ runner.temp }}/release_notes.md
env:
GORELEASER_CURRENT_TAG: ${{ env.RELEASE_TAG }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
notify-slack:
runs-on: ubuntu-latest
needs: [release]
if: ${{ always() && needs.release.result == 'failure' }}
steps:
- name: Notify Slack of release failure
uses: slackapi/slack-github-action@03ea5433c137af7c0495bc0cad1af10403fc800c # v3.0.2
with:
webhook: ${{ secrets.E2E_SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":red_circle: *Release Failed* for `${{ env.RELEASE_TAG }}`\n\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run details>"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Tag: `${{ env.RELEASE_TAG }}` by ${{ github.actor }}"
}
]
}
]
}
A.github/workflows/release.yml+102
2
3
name: Release
version: 2
pro: true
before:
hooks:
- go mod tidy
builds:
- main: ./cmd/git-sync
binary: git-sync
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X entire.io/entire/gitsync/cmd/git-sync/internal/versioninfo.Version={{.Version}}
- -X entire.io/entire/gitsync/cmd/git-sync/internal/versioninfo.Commit={{.ShortCommit}}
- -X entire.io/entire/gitsync/cmd/git-sync/internal/versioninfo.Date={{.CommitDate}}
notarize:
macos:
- enabled: '{{ isEnvSet "MACOS_SIGN_P12" }}'
sign:
certificate: "{{.Env.MACOS_SIGN_P12}}"
password: "{{.Env.MACOS_SIGN_PASSWORD}}"
notarize:
issuer_id: "{{.Env.MACOS_NOTARY_ISSUER_ID}}"
key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}"
key: "{{.Env.MACOS_NOTARY_KEY}}"
wait: true # do not let an unusable binary slip into the wild
archives:
- formats:
- tar.gz
name_template: "git-sync_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
files:
- src: LICENSE
info:
owner: root
group: root
mtime: "{{ .CommitDate }}"
- src: README.md
info:
owner: root
group: root
mtime: "{{ .CommitDate }}"
checksum:
name_template: "checksums.txt"
homebrew_casks:
- name: git-sync
repository:
owner: entireio
name: homebrew-tap
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
directory: Casks
homepage: "https://github.com/entireio/git-sync"
description: "git-sync — replicate and sync Git repositories"
binaries:
- git-sync
skip_upload: auto
A.goreleaser.yaml+68