Skip to content

Commit

Permalink
Merge pull request #126 from supabase/chore/release-workflow
Browse files Browse the repository at this point in the history
create workflow to release to Homebrew and Scoop
  • Loading branch information
imor authored Oct 24, 2023
2 parents 71288ff + 6804941 commit 97242fe
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/manual-release-brew-and-scoop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Release CLI on Homebrew and Scoop

on:
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g. v1.2.3)"
required: true

jobs:
call-release-homebrew-tap:
uses: ./.github/workflows/release-homebrew-tap.yaml
with:
tag: ${{ github.event.inputs.tag }}
secrets:
homebrew_tap_rw: ${{ secrets.HOMEBREW_TAP_RW }}

call-release-scoop-bucket:
uses: ./.github/workflows/release-scoop-bucket.yaml
with:
tag: ${{ github.event.inputs.tag }}
secrets:
scoop_bucket_rw: ${{ secrets.SCOOP_BUCKET_RW }}
109 changes: 109 additions & 0 deletions .github/workflows/release-homebrew-tap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Release Homebrew Tap

on:
workflow_call:
inputs:
tag:
required: true
type: string
secrets:
homebrew_tap_rw:
required: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: supabase/homebrew-tap
ref: 'main'
token: ${{ secrets.homebrew_tap_rw }}
- name: Download Linux AMD64 package
uses: robinraju/[email protected]
with:
repository: "supabase/dbdev"
tag: ${{ inputs.tag }}
fileName: "dbdev-${{ inputs.tag }}-linux-amd64.tar.gz"

- name: Download Linux ARM64 package
uses: robinraju/[email protected]
with:
repository: "supabase/dbdev"
tag: ${{ inputs.tag }}
fileName: "dbdev-${{ inputs.tag }}-linux-arm64.tar.gz"

- name: Download macOS AMD64 package
uses: robinraju/[email protected]
with:
repository: "supabase/dbdev"
tag: ${{ inputs.tag }}
fileName: "dbdev-${{ inputs.tag }}-macos-amd64.tar.gz"

- name: Generate and Push Manifest File
run: |
linux_amd64_hash=`shasum -a 256 dbdev-${{ inputs.tag }}-linux-amd64.tar.gz | cut -d" " -f1`
linux_arm64_hash=`shasum -a 256 dbdev-${{ inputs.tag }}-linux-arm64.tar.gz | cut -d" " -f1`
macos_amd64_hash=`shasum -a 256 dbdev-${{ inputs.tag }}-macos-amd64.tar.gz | cut -d" " -f1`
tag=${{ inputs.tag }}
# strip the leading v
version=${tag:1}
# update dbdev.rb file
echo '# typed: false' > dbdev.rb
echo '# frozen_string_literal: true' >> dbdev.rb
echo '' >> dbdev.rb
echo 'class Dbdev < Formula' >> dbdev.rb
echo ' desc "Dbdev CLI"' >> dbdev.rb
echo ' homepage "https://database.dev/"' >> dbdev.rb
echo " version \"${version}\"" >> dbdev.rb
echo ' license "MIT"' >> dbdev.rb
echo '' >> dbdev.rb
echo ' on_macos do' >> dbdev.rb
echo ' if Hardware::CPU.arm?' >> dbdev.rb
echo " url \"https://github.com/supabase/dbdev/releases/download/v${version}/dbdev-v${version}-macos-amd64.tar.gz\"" >> dbdev.rb
echo " sha256 \"${macos_amd64_hash}\"" >> dbdev.rb
echo '' >> dbdev.rb
echo ' def install' >> dbdev.rb
echo ' bin.install "dbdev"' >> dbdev.rb
echo ' end' >> dbdev.rb
echo ' end' >> dbdev.rb
echo ' if Hardware::CPU.intel?' >> dbdev.rb
echo " url \"https://github.com/supabase/dbdev/releases/download/v${version}/dbdev-v${version}-macos-amd64.tar.gz\"" >> dbdev.rb
echo " sha256 \"${macos_amd64_hash}\"" >> dbdev.rb
echo '' >> dbdev.rb
echo ' def install' >> dbdev.rb
echo ' bin.install "dbdev"' >> dbdev.rb
echo ' end' >> dbdev.rb
echo ' end' >> dbdev.rb
echo ' end' >> dbdev.rb
echo '' >> dbdev.rb
echo ' on_linux do' >> dbdev.rb
echo ' if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?' >> dbdev.rb
echo " url \"https://github.com/supabase/dbdev/releases/download/v${version}/dbdev-v${version}-linux-arm64.tar.gz\"" >> dbdev.rb
echo " sha256 \"${linux_arm64_hash}\"" >> dbdev.rb
echo '' >> dbdev.rb
echo ' def install' >> dbdev.rb
echo ' bin.install "dbdev"' >> dbdev.rb
echo ' end' >> dbdev.rb
echo ' end' >> dbdev.rb
echo ' if Hardware::CPU.intel?' >> dbdev.rb
echo " url \"https://github.com/supabase/dbdev/releases/download/v${version}/dbdev-v${version}-linux-amd64.tar.gz\"" >> dbdev.rb
echo " sha256 \"${linux_amd64_hash}\"" >> dbdev.rb
echo '' >> dbdev.rb
echo ' def install' >> dbdev.rb
echo ' bin.install "dbdev"' >> dbdev.rb
echo ' end' >> dbdev.rb
echo ' end' >> dbdev.rb
echo ' end' >> dbdev.rb
echo 'end' >> dbdev.rb
echo ''
git diff
git config user.name "dbdev release-homebrew-tap.yaml workflow"
git config user.email [email protected]
git add ./dbdev.rb
git commit -m "dbdev brew formula update for version v${version}"
git push
62 changes: 62 additions & 0 deletions .github/workflows/release-scoop-bucket.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release Scoop Bucket

on:
workflow_call:
inputs:
tag:
required: true
type: string
secrets:
scoop_bucket_rw:
required: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: supabase/scoop-bucket
ref: 'main'
token: ${{ secrets.scoop_bucket_rw }}

- name: Download Windows AMD64 package
uses: robinraju/[email protected]
with:
repository: "supabase/dbdev"
tag: ${{ inputs.tag }}
fileName: "dbdev-${{ inputs.tag }}-windows-amd64.zip"

- name: Generate and Push Manifest File
run: |
windows_amd64_hash=`shasum -a 256 dbdev-${{ inputs.tag }}-windows-amd64.zip | cut -d" " -f1`
tag=${{ inputs.tag }}
# strip the leading v
version=${tag:1}
# update dbdev.json file
echo '{' > dbdev.json
echo " \"version\": \"${version}\"," >> dbdev.json
echo ' "architecture": {' >> dbdev.json
echo ' "64bit": {' >> dbdev.json
echo " \"url\": \"https://github.com/supabase/dbdev/releases/download/v${version}/dbdev-v${version}-windows-amd64.zip\"," >> dbdev.json
echo ' "bin": [' >> dbdev.json
echo ' "dbdev.exe"' >> dbdev.json
echo ' ],' >> dbdev.json
echo " \"hash\": \"${windows_amd64_hash}\"" >> dbdev.json
echo ' }' >> dbdev.json
echo ' },' >> dbdev.json
echo ' "homepage": "https://database.dev",' >> dbdev.json
echo ' "license": "Apache",' >> dbdev.json
echo ' "description": "CLI to help publish extensions to database.dev"' >> dbdev.json
echo '}' >> dbdev.json
echo ''
git diff
git config user.name "dbdev release-scoop-bucket.yaml workflow"
git config user.email [email protected]
git add ./dbdev.json
git commit -m "dbdev scoop update for version v${version}"
git push

1 comment on commit 97242fe

@vercel
Copy link

@vercel vercel bot commented on 97242fe Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.