Repository navigation
129 lines (115 loc) · 5 KB
/
Copy pathrelease.yml
File metadata and controls
129 lines (115 loc) · 5 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Release
on:
push:
tags:
- "v*.*.*-alpha"
permissions: {}
# Releases serialize globally, not per tag: two tags pushed together each start a
# run, and both publish to the same Homebrew and Scoop repositories. queue: max
# because the default, single, cancels whichever release is already waiting when
# the next one arrives — serializing by dropping a release is not serializing.
concurrency:
group: release
queue: max
cancel-in-progress: false
jobs:
verify:
name: Verify release source
permissions:
contents: read
uses: ./.github/workflows/ci.yml
release:
name: Publish signed release, Homebrew, and Scoop
needs: [verify]
runs-on: macos-15
timeout-minutes: 60
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache-dependency-path: go.sum
# Tags as well as main: lineage validation needs main, and the changelog
# needs the preceding tag. checkout fetches only the tag being released,
# so without this every release would log the whole history.
- name: Fetch release lineage
run: git fetch --force --tags origin +refs/heads/main:refs/remotes/origin/main
- name: Validate tag and main lineage
run: scripts/validate-release-tag.sh "${GITHUB_REF_NAME}" origin/main
# Against the published release, not against local tags: a tag that exists
# says nothing about whether its release ran, and a queued release is not
# stale merely because a newer tag was created while it waited.
- name: Refuse to publish behind the current release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: scripts/require-newest-release.sh "${GITHUB_REF_NAME}" "${GITHUB_REPOSITORY}"
- name: Verify release credentials and publication targets
env:
GH_TOKEN: ${{ secrets.PACKAGE_REPOS_TOKEN }}
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
run: |
required=(
GH_TOKEN
MACOS_NOTARY_ISSUER_ID
MACOS_NOTARY_KEY
MACOS_NOTARY_KEY_ID
MACOS_SIGN_P12
MACOS_SIGN_PASSWORD
)
for name in "${required[@]}"; do
if [ -z "${!name:-}" ]; then
echo "Required release secret ${name} is not configured." >&2
exit 1
fi
done
for repository in labstack/homebrew-tap labstack/scoop-bucket; do
access=$(gh api "repos/${repository}" --jq '[.default_branch, .permissions.push] | @tsv')
if [ "$access" != $'main\ttrue' ]; then
echo "PACKAGE_REPOS_TOKEN must have contents write access to ${repository}:main." >&2
exit 1
fi
done
# No GoReleaser Pro features: native signing happens in the OSS build hook.
- name: Prepare temporary signing keychain
env:
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
run: bash scripts/macos-signing-keychain.sh
- name: Publish immutable release
uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
with:
distribution: goreleaser
version: v2.18.0
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_REPOS_TOKEN: ${{ secrets.PACKAGE_REPOS_TOKEN }}
DRIGA_SIGNING_KEYCHAIN: ${{ env.DRIGA_SIGNING_KEYCHAIN }}
DRIGA_SIGNING_IDENTITY: ${{ env.DRIGA_SIGNING_IDENTITY }}
DRIGA_NOTARY_KEY: ${{ env.DRIGA_NOTARY_KEY }}
DRIGA_NOTARY_KEY_ID: ${{ env.DRIGA_NOTARY_KEY_ID }}
DRIGA_NOTARY_ISSUER: ${{ env.DRIGA_NOTARY_ISSUER }}
# The published artifacts, not a snapshot of them. Until this ran here,
# nothing checked what a user actually downloads.
- name: Verify published artifacts and nested service signatures
env:
DRIGA_VERIFY_SIGNATURES: "true"
run: scripts/verify-release-dist.sh dist
- name: Delete temporary signing keychain
if: always()
run: |
keychain="$RUNNER_TEMP/driga-signing/signing.keychain-db"
# delete-keychain also removes it from the user search list.
if [ -f "$keychain" ]; then security delete-keychain "$keychain"; fi
rm -rf "$RUNNER_TEMP/driga-signing"