-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (147 loc) · 5.07 KB
/
Copy pathrelease.yml
File metadata and controls
164 lines (147 loc) · 5.07 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
permissions:
contents: read
strategy:
matrix:
include:
- os: ubuntu-latest
arch: amd64
platform: linux-amd64
- os: ubuntu-24.04-arm
arch: arm64
platform: linux-arm64
- os: macos-14
arch: arm64
platform: darwin-arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: graalvm/setup-graalvm@54b4f5a65c1a84b2fdfdc2078fe43df32819e4b1 # v1
with:
java-version: '21'
distribution: 'graalvm'
native-image-job-reports: 'true'
- uses: DeLaGuardo/setup-clojure@cc67f8308550d0f18b0ba445c2476f84626a5d6a # 13.1
with:
cli: latest
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
~/.m2/repository
~/.gitlibs
~/.clojure/.cpcache
key: ${{ runner.os }}-${{ matrix.arch }}-clojure-${{ hashFiles('deps.edn') }}
restore-keys: ${{ runner.os }}-${{ matrix.arch }}-clojure-
- name: Stamp version from tag
run: echo "${GITHUB_REF_NAME#v}" > resources/CEEKER_VERSION
- name: Build uberjar
run: clojure -T:build uber
- name: Build native image
run: |
native-image \
-jar target/ceeker.jar \
-o ceeker-${{ matrix.platform }}
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ceeker-${{ matrix.platform }}
path: ceeker-${{ matrix.platform }}
release:
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release
for dir in artifacts/ceeker-*; do
name=$(basename "$dir")
cp "$dir/$name" "release/$name"
chmod +x "release/$name"
tar czf "release/${name}.tar.gz" -C release "$name"
# Remove raw binary — distribute tarball only
rm "release/$name"
done
- name: Generate checksums
working-directory: release
run: sha256sum *.tar.gz > checksums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2
with:
generate_release_notes: true
files: |
release/*.tar.gz
release/checksums.txt
notify-homebrew-tap:
needs: release
runs-on: ubuntu-latest
concurrency:
group: notify-homebrew-tap-${{ github.ref_name }}
cancel-in-progress: false
permissions:
contents: read
steps:
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Download release tarballs
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p tarballs
for platform in linux-amd64 linux-arm64 darwin-arm64; do
gh release download "$GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY" \
--pattern "ceeker-${platform}.tar.gz" \
--dir tarballs
done
- name: Compute SHA256 checksums
id: sha
run: |
for platform in linux-amd64 linux-arm64 darwin-arm64; do
file="tarballs/ceeker-${platform}.tar.gz"
if [ ! -f "$file" ]; then
echo "::error::Missing tarball: $file"
exit 1
fi
sha=$(sha256sum "$file" | awk '{print $1}')
key="sha_$(echo "$platform" | tr '-' '_')"
echo "${key}=${sha}" >> "$GITHUB_OUTPUT"
done
- name: Dispatch to homebrew-tap
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
TAG: ${{ github.ref_name }}
SHA_DARWIN_ARM64: ${{ steps.sha.outputs.sha_darwin_arm64 }}
SHA_LINUX_AMD64: ${{ steps.sha.outputs.sha_linux_amd64 }}
SHA_LINUX_ARM64: ${{ steps.sha.outputs.sha_linux_arm64 }}
SENDER: ${{ github.repository }}
run: |
jq -n \
--arg version "$VERSION" \
--arg tag "$TAG" \
--arg sha_darwin_arm64 "$SHA_DARWIN_ARM64" \
--arg sha_linux_amd64 "$SHA_LINUX_AMD64" \
--arg sha_linux_arm64 "$SHA_LINUX_ARM64" \
--arg sender "$SENDER" \
'{
event_type: "update-ceeker-formula",
client_payload: {
version: $version,
tag: $tag,
sha_darwin_arm64: $sha_darwin_arm64,
sha_linux_amd64: $sha_linux_amd64,
sha_linux_arm64: $sha_linux_arm64,
sender: $sender
}
}' | gh api repos/boxp/homebrew-tap/dispatches --method POST --input -