-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (122 loc) · 4.19 KB
/
Copy pathrelease.yml
File metadata and controls
140 lines (122 loc) · 4.19 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
130
131
132
133
134
135
136
137
138
139
140
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g. v0.1.11). Created if it does not already exist.'
required: true
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.goos }}/${{ matrix.goarch }}
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.value }}
strategy:
matrix:
include:
- goos: darwin
goarch: arm64
- goos: darwin
goarch: amd64
- goos: linux
goarch: arm64
- goos: linux
goarch: amd64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Resolve version
id: version
run: echo "value=${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}" >> "$GITHUB_OUTPUT"
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
go build -trimpath -ldflags="-s -w -X main.version=${{ steps.version.outputs.value }}" \
-o dossier-${{ matrix.goos }}-${{ matrix.goarch }} \
./cmd/dossier
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dossier-${{ matrix.goos }}-${{ matrix.goarch }}
path: dossier-${{ matrix.goos }}-${{ matrix.goarch }}
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create checksums
run: sha256sum dossier-* > checksums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.build.outputs.version }}
files: |
dossier-*
checksums.txt
generate_release_notes: true
update-tap:
needs: [build, release]
runs-on: ubuntu-latest
steps:
- name: Update Homebrew tap
env:
GH_PAT: ${{ secrets.GH_PAT }}
TAG: ${{ needs.build.outputs.version }}
run: |
VERSION="${TAG#v}"
CHECKSUMS_URL="https://github.com/execsumo/dossiers/releases/download/${TAG}/checksums.txt"
CHECKSUMS="$(curl -sL "$CHECKSUMS_URL")"
sha() { echo "$CHECKSUMS" | grep " dossier-$1\$" | cut -d' ' -f1; }
git clone "https://execsumo:${GH_PAT}@github.com/execsumo/homebrew-tap.git" tap
mkdir -p tap/Formula
cat > tap/Formula/dossier.rb <<EOF
class Dossier < Formula
desc "Local durable memory layer for agent-driven work in Claude Code"
homepage "https://github.com/execsumo/dossiers"
version "${VERSION}"
license "MIT"
on_macos do
if Hardware::CPU.arm?
url "https://github.com/execsumo/dossiers/releases/download/${TAG}/dossier-darwin-arm64"
sha256 "$(sha darwin-arm64)"
else
url "https://github.com/execsumo/dossiers/releases/download/${TAG}/dossier-darwin-amd64"
sha256 "$(sha darwin-amd64)"
end
end
on_linux do
if Hardware::CPU.arm?
url "https://github.com/execsumo/dossiers/releases/download/${TAG}/dossier-linux-arm64"
sha256 "$(sha linux-arm64)"
else
url "https://github.com/execsumo/dossiers/releases/download/${TAG}/dossier-linux-amd64"
sha256 "$(sha linux-amd64)"
end
end
def install
bin.install Dir["dossier-*"].first => "dossier"
end
test do
system "#{bin}/dossier", "--version"
end
end
EOF
cd tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/dossier.rb
git diff --cached --quiet && echo "No changes" && exit 0
git commit -m "Update dossier to ${TAG}"
git push origin HEAD:refs/heads/main