diff --git a/.github/workflows/manual-release-brew-and-scoop.yaml b/.github/workflows/manual-release-brew-and-scoop.yaml new file mode 100644 index 00000000..68751576 --- /dev/null +++ b/.github/workflows/manual-release-brew-and-scoop.yaml @@ -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 }} diff --git a/.github/workflows/release-homebrew-tap.yaml b/.github/workflows/release-homebrew-tap.yaml new file mode 100644 index 00000000..a537102f --- /dev/null +++ b/.github/workflows/release-homebrew-tap.yaml @@ -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/release-downloader@v1.8 + with: + repository: "supabase/dbdev" + tag: ${{ inputs.tag }} + fileName: "dbdev-${{ inputs.tag }}-linux-amd64.tar.gz" + + - name: Download Linux ARM64 package + uses: robinraju/release-downloader@v1.8 + with: + repository: "supabase/dbdev" + tag: ${{ inputs.tag }} + fileName: "dbdev-${{ inputs.tag }}-linux-arm64.tar.gz" + + - name: Download macOS AMD64 package + uses: robinraju/release-downloader@v1.8 + 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 raminder@supabase.io + git add ./dbdev.rb + git commit -m "dbdev brew formula update for version v${version}" + git push diff --git a/.github/workflows/release-scoop-bucket.yaml b/.github/workflows/release-scoop-bucket.yaml new file mode 100644 index 00000000..c4d22331 --- /dev/null +++ b/.github/workflows/release-scoop-bucket.yaml @@ -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/release-downloader@v1.8 + 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 raminder@supabase.io + git add ./dbdev.json + git commit -m "dbdev scoop update for version v${version}" + git push