Skip to content

Commit 2bd836e

Browse files
committed
Add release pipeline with single-repo Homebrew/Scoop distribution
- GoReleaser config for cross-platform builds (macOS, Linux, Windows × amd64, arm64) - Release workflow with concurrency guard on v* tags - Sync-manifests workflow renders and commits Formula/dci.rb and bucket/dci.json directly to this repo (no external tap/bucket repos or tokens needed) - Post-release smoke tests for Homebrew, deb, rpm (Fedora), and Windows zip - Shared packaging/render.sh with fail-fast checksum validation - DISTRIBUTION.md with rollback, troubleshooting, and manual re-run docs
1 parent 5469c46 commit 2bd836e

15 files changed

Lines changed: 734 additions & 4 deletions
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: Post-release Verify
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: Release tag to verify
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
homebrew-smoke:
19+
runs-on: macos-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Resolve release tag
26+
id: release
27+
run: |
28+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
29+
tag="${{ inputs.tag }}"
30+
else
31+
tag="${{ github.event.release.tag_name }}"
32+
fi
33+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
34+
35+
- name: Download checksums
36+
env:
37+
GH_TOKEN: ${{ github.token }}
38+
run: |
39+
mkdir -p dist/verify
40+
gh release download "${{ steps.release.outputs.tag }}" \
41+
--repo "$GITHUB_REPOSITORY" \
42+
--pattern checksums.txt \
43+
--dir dist/verify
44+
45+
- name: Render formula
46+
env:
47+
TAG: ${{ steps.release.outputs.tag }}
48+
run: |
49+
set -euo pipefail
50+
version="${TAG#v}"
51+
base_url="https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG}"
52+
53+
bash packaging/render.sh \
54+
dist/verify/checksums.txt "$version" "$base_url" \
55+
packaging/homebrew/dci.rb.tmpl dist/verify/dci.rb
56+
57+
- name: Install via Homebrew formula
58+
run: |
59+
brew install --formula ./dist/verify/dci.rb
60+
dci --version
61+
dci --help >/dev/null
62+
63+
linux-deb-smoke:
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- name: Resolve release tag
68+
id: release
69+
run: |
70+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
71+
tag="${{ inputs.tag }}"
72+
else
73+
tag="${{ github.event.release.tag_name }}"
74+
fi
75+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
76+
77+
- name: Download amd64 deb
78+
env:
79+
GH_TOKEN: ${{ github.token }}
80+
run: |
81+
mkdir -p dist/verify
82+
gh release download "${{ steps.release.outputs.tag }}" \
83+
--repo "$GITHUB_REPOSITORY" \
84+
--pattern "*_amd64.deb" \
85+
--dir dist/verify
86+
87+
- name: Install and verify
88+
run: |
89+
set -euo pipefail
90+
pkg="$(find dist/verify -maxdepth 1 -type f -name '*_amd64.deb' | head -n 1)"
91+
if [ -z "$pkg" ]; then
92+
echo "ERROR: No amd64 .deb found in dist/verify" >&2
93+
ls -la dist/verify/
94+
exit 1
95+
fi
96+
sudo dpkg -i "$pkg"
97+
dci --version
98+
dci --help >/dev/null
99+
100+
linux-rpm-smoke:
101+
runs-on: ubuntu-latest
102+
container:
103+
image: fedora:latest
104+
105+
steps:
106+
- name: Resolve release tag
107+
id: release
108+
run: |
109+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
110+
tag="${{ inputs.tag }}"
111+
else
112+
tag="${{ github.event.release.tag_name }}"
113+
fi
114+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
115+
116+
- name: Install gh CLI
117+
run: dnf install -y gh
118+
119+
- name: Download amd64 rpm
120+
env:
121+
GH_TOKEN: ${{ github.token }}
122+
run: |
123+
mkdir -p dist/verify
124+
gh release download "${{ steps.release.outputs.tag }}" \
125+
--repo "$GITHUB_REPOSITORY" \
126+
--pattern "*_amd64.rpm" \
127+
--dir dist/verify
128+
129+
- name: Install and verify
130+
run: |
131+
set -euo pipefail
132+
pkg="$(find dist/verify -maxdepth 1 -type f -name '*_amd64.rpm' | head -n 1)"
133+
if [ -z "$pkg" ]; then
134+
echo "ERROR: No amd64 .rpm found in dist/verify" >&2
135+
ls -la dist/verify/
136+
exit 1
137+
fi
138+
dnf install -y "$pkg"
139+
dci --version
140+
dci --help >/dev/null
141+
142+
windows-zip-smoke:
143+
runs-on: windows-latest
144+
145+
steps:
146+
- name: Resolve release tag
147+
id: release
148+
shell: bash
149+
run: |
150+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
151+
tag="${{ inputs.tag }}"
152+
else
153+
tag="${{ github.event.release.tag_name }}"
154+
fi
155+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
156+
157+
- name: Download amd64 zip
158+
shell: bash
159+
env:
160+
GH_TOKEN: ${{ github.token }}
161+
run: |
162+
mkdir -p dist/verify
163+
gh release download "${{ steps.release.outputs.tag }}" \
164+
--repo "$GITHUB_REPOSITORY" \
165+
--pattern "*_windows_amd64.zip" \
166+
--dir dist/verify
167+
168+
- name: Extract and verify
169+
shell: pwsh
170+
run: |
171+
$zip = Get-ChildItem dist/verify/*_windows_amd64.zip | Select-Object -First 1
172+
Expand-Archive -Path $zip.FullName -DestinationPath dist/verify/windows
173+
& "$PWD\dist\verify\windows\dci.exe" --version
174+
& "$PWD\dist\verify\windows\dci.exe" --help | Out-Null

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
concurrency:
12+
group: release-${{ github.ref }}
13+
cancel-in-progress: false
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Setup Go
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version-file: go.mod
29+
cache: true
30+
31+
- name: Publish release assets
32+
uses: goreleaser/goreleaser-action@v6
33+
with:
34+
version: "~> v2"
35+
args: release --clean
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Sync Package Manifests
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: Release tag to render and sync
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: write
16+
17+
concurrency:
18+
group: sync-manifests
19+
cancel-in-progress: false
20+
21+
jobs:
22+
render-and-sync:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
ref: main
30+
31+
- name: Resolve release tag
32+
id: release
33+
run: |
34+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
35+
tag="${{ inputs.tag }}"
36+
else
37+
tag="${{ github.event.release.tag_name }}"
38+
fi
39+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
40+
41+
- name: Download checksums
42+
env:
43+
GH_TOKEN: ${{ github.token }}
44+
run: |
45+
mkdir -p dist/render
46+
gh release download "${{ steps.release.outputs.tag }}" \
47+
--repo "$GITHUB_REPOSITORY" \
48+
--pattern checksums.txt \
49+
--dir dist/render
50+
51+
- name: Render manifests
52+
env:
53+
TAG: ${{ steps.release.outputs.tag }}
54+
run: |
55+
set -euo pipefail
56+
version="${TAG#v}"
57+
base_url="https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG}"
58+
cs="dist/render/checksums.txt"
59+
60+
bash packaging/render.sh "$cs" "$version" "$base_url" \
61+
packaging/homebrew/dci.rb.tmpl dist/render/homebrew/dci.rb
62+
63+
bash packaging/render.sh "$cs" "$version" "$base_url" \
64+
packaging/scoop/dci.json.tmpl dist/render/scoop/dci.json
65+
66+
bash packaging/render.sh "$cs" "$version" "$base_url" \
67+
packaging/winget/dci.yaml.tmpl dist/render/winget/DoiT.dci.yaml
68+
69+
bash packaging/render.sh "$cs" "$version" "$base_url" \
70+
packaging/winget/dci.installer.yaml.tmpl dist/render/winget/DoiT.dci.installer.yaml
71+
72+
bash packaging/render.sh "$cs" "$version" "$base_url" \
73+
packaging/winget/dci.locale.en-US.yaml.tmpl dist/render/winget/DoiT.dci.locale.en-US.yaml
74+
75+
- name: Upload rendered manifests
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: package-manifests-${{ steps.release.outputs.tag }}
79+
path: dist/render
80+
81+
- name: Commit Homebrew formula and Scoop manifest
82+
env:
83+
TAG: ${{ steps.release.outputs.tag }}
84+
run: |
85+
set -euo pipefail
86+
87+
cp dist/render/homebrew/dci.rb Formula/dci.rb
88+
cp dist/render/scoop/dci.json bucket/dci.json
89+
90+
if git diff --quiet -- Formula/dci.rb bucket/dci.json; then
91+
echo "Homebrew formula and Scoop manifest already up to date."
92+
exit 0
93+
fi
94+
95+
git config user.name "github-actions[bot]"
96+
git config user.email "github-actions[bot]@users.noreply.github.com"
97+
git add Formula/dci.rb bucket/dci.json
98+
git commit -m "Update Homebrew formula and Scoop manifest for ${TAG}"
99+
git push
100+
101+
- name: Summarize WinGet handoff
102+
run: |
103+
{
104+
echo "### WinGet"
105+
echo
106+
echo "Rendered WinGet manifests are attached as a workflow artifact."
107+
echo "Submit the files in dist/render/winget to microsoft/winget-pkgs for this release."
108+
} >> "$GITHUB_STEP_SUMMARY"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dci
2+
dist/
23
*.exe
34
*.dll
45
*.so

0 commit comments

Comments
 (0)