Skip to content

Commit 813ecb3

Browse files
committed
feat: automating brew tap
1 parent 24349b4 commit 813ecb3

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

.github/workflows/brew.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: homebrew-releaser
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
homebrew-releaser:
9+
runs-on: ubuntu-latest
10+
name: homebrew-releaser
11+
steps:
12+
- name: publish tap
13+
uses: Justintime50/homebrew-releaser@v1
14+
with:
15+
homebrew_owner: grampelberg
16+
homebrew_tap: homebrew-kty
17+
github_token: ${{ secrets.BREW_TOKEN }}
18+
19+
commit_owner: Thomas Rampelberg
20+
commit_email: thomas@saunter.org
21+
22+
install: 'bin.install "kty" => "kty"'
23+
test: 'assert_match("kty", shell_output("kty"))'
24+
25+
target_darwin_amd64: false
26+
target_darwin_arm64: true
27+
target_linux_amd64: true
28+
target_linux_arm64: true
29+
30+
update_readme_table: true
31+
skip_commit: false
32+
33+
debug: true

.github/workflows/build.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ jobs:
5151
env:
5252
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
5353
run: |
54-
just set-version build-binary
55-
56-
- name: rename
57-
run: |-
58-
cp target/release/kty kty-${{ matrix.os }}-${{ matrix.arch }}
54+
just set-version build-binary tar-bin ${{ matrix.os }} ${{ matrix.arch }}
5955
6056
- uses: actions/upload-artifact@v4
6157
with:

justfile

+8-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ build-binary:
4040
build-image:
4141
docker build -t {{ image }} -f docker/kty.dockerfile .
4242

43+
tar-bin os arch:
44+
tar -czf kty-{{ version }}-{{ os }}-{{ arch }}.tar.gz -C target/release kty
45+
4346
login-ghcr:
4447
@if [ -z ${GHCR_USER+x} ] || [ -z ${GHCR_TOKEN+x} ]; then \
4548
echo "{{ red }}GHCR_USER and/or GHCR_TOKEN is not set.{{ normal }} See .envrc.example" && exit 1; \
@@ -67,10 +70,14 @@ extract-from-digests:
6770
echo "Extracting {{ image }}@sha256:${sha}"
6871

6972
container_id="$(docker create --platform=${os}/${arch} {{ image }}@sha256:${sha})"
70-
docker cp "${container_id}:/usr/local/bin/kty" "/tmp/bins/${name}"
73+
docker cp "${container_id}:/usr/local/bin/kty" "/tmp/bins/kty"
7174
docker rm "${container_id}"
75+
76+
tar -czf "/tmp/bins/kty-{{ version }}-${os}-${arch}.tar.gz" -C /tmp/bins kty
7277
done
7378

79+
rm /tmp/bins/kty
80+
7481
set-version:
7582
git grep -l "{{ version_placeholder }}" | grep -v "justfile" | xargs -I {} sed -i'.tmp' -e 's/{{ version_placeholder }}/{{ version }}/g' {}
7683

0 commit comments

Comments
 (0)