Skip to content

Commit 97242fe

Browse files
authored
Merge pull request #126 from supabase/chore/release-workflow
create workflow to release to Homebrew and Scoop
2 parents 71288ff + 6804941 commit 97242fe

File tree

3 files changed

+194
-0
lines changed

3 files changed

+194
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Release CLI on Homebrew and Scoop
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Tag to release (e.g. v1.2.3)"
8+
required: true
9+
10+
jobs:
11+
call-release-homebrew-tap:
12+
uses: ./.github/workflows/release-homebrew-tap.yaml
13+
with:
14+
tag: ${{ github.event.inputs.tag }}
15+
secrets:
16+
homebrew_tap_rw: ${{ secrets.HOMEBREW_TAP_RW }}
17+
18+
call-release-scoop-bucket:
19+
uses: ./.github/workflows/release-scoop-bucket.yaml
20+
with:
21+
tag: ${{ github.event.inputs.tag }}
22+
secrets:
23+
scoop_bucket_rw: ${{ secrets.SCOOP_BUCKET_RW }}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Release Homebrew Tap
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tag:
7+
required: true
8+
type: string
9+
secrets:
10+
homebrew_tap_rw:
11+
required: true
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
repository: supabase/homebrew-tap
20+
ref: 'main'
21+
token: ${{ secrets.homebrew_tap_rw }}
22+
- name: Download Linux AMD64 package
23+
uses: robinraju/[email protected]
24+
with:
25+
repository: "supabase/dbdev"
26+
tag: ${{ inputs.tag }}
27+
fileName: "dbdev-${{ inputs.tag }}-linux-amd64.tar.gz"
28+
29+
- name: Download Linux ARM64 package
30+
uses: robinraju/[email protected]
31+
with:
32+
repository: "supabase/dbdev"
33+
tag: ${{ inputs.tag }}
34+
fileName: "dbdev-${{ inputs.tag }}-linux-arm64.tar.gz"
35+
36+
- name: Download macOS AMD64 package
37+
uses: robinraju/[email protected]
38+
with:
39+
repository: "supabase/dbdev"
40+
tag: ${{ inputs.tag }}
41+
fileName: "dbdev-${{ inputs.tag }}-macos-amd64.tar.gz"
42+
43+
- name: Generate and Push Manifest File
44+
run: |
45+
linux_amd64_hash=`shasum -a 256 dbdev-${{ inputs.tag }}-linux-amd64.tar.gz | cut -d" " -f1`
46+
linux_arm64_hash=`shasum -a 256 dbdev-${{ inputs.tag }}-linux-arm64.tar.gz | cut -d" " -f1`
47+
macos_amd64_hash=`shasum -a 256 dbdev-${{ inputs.tag }}-macos-amd64.tar.gz | cut -d" " -f1`
48+
49+
tag=${{ inputs.tag }}
50+
# strip the leading v
51+
version=${tag:1}
52+
53+
# update dbdev.rb file
54+
echo '# typed: false' > dbdev.rb
55+
echo '# frozen_string_literal: true' >> dbdev.rb
56+
echo '' >> dbdev.rb
57+
echo 'class Dbdev < Formula' >> dbdev.rb
58+
echo ' desc "Dbdev CLI"' >> dbdev.rb
59+
echo ' homepage "https://database.dev/"' >> dbdev.rb
60+
echo " version \"${version}\"" >> dbdev.rb
61+
echo ' license "MIT"' >> dbdev.rb
62+
echo '' >> dbdev.rb
63+
echo ' on_macos do' >> dbdev.rb
64+
echo ' if Hardware::CPU.arm?' >> dbdev.rb
65+
echo " url \"https://github.com/supabase/dbdev/releases/download/v${version}/dbdev-v${version}-macos-amd64.tar.gz\"" >> dbdev.rb
66+
echo " sha256 \"${macos_amd64_hash}\"" >> dbdev.rb
67+
echo '' >> dbdev.rb
68+
echo ' def install' >> dbdev.rb
69+
echo ' bin.install "dbdev"' >> dbdev.rb
70+
echo ' end' >> dbdev.rb
71+
echo ' end' >> dbdev.rb
72+
echo ' if Hardware::CPU.intel?' >> dbdev.rb
73+
echo " url \"https://github.com/supabase/dbdev/releases/download/v${version}/dbdev-v${version}-macos-amd64.tar.gz\"" >> dbdev.rb
74+
echo " sha256 \"${macos_amd64_hash}\"" >> dbdev.rb
75+
echo '' >> dbdev.rb
76+
echo ' def install' >> dbdev.rb
77+
echo ' bin.install "dbdev"' >> dbdev.rb
78+
echo ' end' >> dbdev.rb
79+
echo ' end' >> dbdev.rb
80+
echo ' end' >> dbdev.rb
81+
echo '' >> dbdev.rb
82+
echo ' on_linux do' >> dbdev.rb
83+
echo ' if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?' >> dbdev.rb
84+
echo " url \"https://github.com/supabase/dbdev/releases/download/v${version}/dbdev-v${version}-linux-arm64.tar.gz\"" >> dbdev.rb
85+
echo " sha256 \"${linux_arm64_hash}\"" >> dbdev.rb
86+
echo '' >> dbdev.rb
87+
echo ' def install' >> dbdev.rb
88+
echo ' bin.install "dbdev"' >> dbdev.rb
89+
echo ' end' >> dbdev.rb
90+
echo ' end' >> dbdev.rb
91+
echo ' if Hardware::CPU.intel?' >> dbdev.rb
92+
echo " url \"https://github.com/supabase/dbdev/releases/download/v${version}/dbdev-v${version}-linux-amd64.tar.gz\"" >> dbdev.rb
93+
echo " sha256 \"${linux_amd64_hash}\"" >> dbdev.rb
94+
echo '' >> dbdev.rb
95+
echo ' def install' >> dbdev.rb
96+
echo ' bin.install "dbdev"' >> dbdev.rb
97+
echo ' end' >> dbdev.rb
98+
echo ' end' >> dbdev.rb
99+
echo ' end' >> dbdev.rb
100+
echo 'end' >> dbdev.rb
101+
echo ''
102+
103+
git diff
104+
105+
git config user.name "dbdev release-homebrew-tap.yaml workflow"
106+
git config user.email [email protected]
107+
git add ./dbdev.rb
108+
git commit -m "dbdev brew formula update for version v${version}"
109+
git push
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Release Scoop Bucket
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tag:
7+
required: true
8+
type: string
9+
secrets:
10+
scoop_bucket_rw:
11+
required: true
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
repository: supabase/scoop-bucket
20+
ref: 'main'
21+
token: ${{ secrets.scoop_bucket_rw }}
22+
23+
- name: Download Windows AMD64 package
24+
uses: robinraju/[email protected]
25+
with:
26+
repository: "supabase/dbdev"
27+
tag: ${{ inputs.tag }}
28+
fileName: "dbdev-${{ inputs.tag }}-windows-amd64.zip"
29+
30+
- name: Generate and Push Manifest File
31+
run: |
32+
windows_amd64_hash=`shasum -a 256 dbdev-${{ inputs.tag }}-windows-amd64.zip | cut -d" " -f1`
33+
34+
tag=${{ inputs.tag }}
35+
# strip the leading v
36+
version=${tag:1}
37+
38+
# update dbdev.json file
39+
echo '{' > dbdev.json
40+
echo " \"version\": \"${version}\"," >> dbdev.json
41+
echo ' "architecture": {' >> dbdev.json
42+
echo ' "64bit": {' >> dbdev.json
43+
echo " \"url\": \"https://github.com/supabase/dbdev/releases/download/v${version}/dbdev-v${version}-windows-amd64.zip\"," >> dbdev.json
44+
echo ' "bin": [' >> dbdev.json
45+
echo ' "dbdev.exe"' >> dbdev.json
46+
echo ' ],' >> dbdev.json
47+
echo " \"hash\": \"${windows_amd64_hash}\"" >> dbdev.json
48+
echo ' }' >> dbdev.json
49+
echo ' },' >> dbdev.json
50+
echo ' "homepage": "https://database.dev",' >> dbdev.json
51+
echo ' "license": "Apache",' >> dbdev.json
52+
echo ' "description": "CLI to help publish extensions to database.dev"' >> dbdev.json
53+
echo '}' >> dbdev.json
54+
echo ''
55+
56+
git diff
57+
58+
git config user.name "dbdev release-scoop-bucket.yaml workflow"
59+
git config user.email [email protected]
60+
git add ./dbdev.json
61+
git commit -m "dbdev scoop update for version v${version}"
62+
git push

0 commit comments

Comments
 (0)