Merge pull request #285 from supabase/rs/bump-macos-runner-version #57
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release CLI | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Read CLI version | |
| uses: SebRollen/toml-action@v1.2.0 | |
| id: read_cli_version | |
| with: | |
| file: './cli/Cargo.toml' | |
| field: 'package.version' | |
| - name: Check Release Version is Same as CLI Version | |
| if: ${{ !endsWith(github.ref, steps.read_cli_version.outputs.value) }} | |
| run: | | |
| echo "Tag version ${{ github.ref }} doesn't match Cargo.toml version ${{ steps.read_cli_version.outputs.value }}"; | |
| echo "Did you forget to update version in Cargo.toml?" | |
| exit 1 | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: ${{ github.ref }} | |
| body: | | |
| TODO: Write release notes | |
| draft: false | |
| prerelease: false | |
| outputs: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| build-linux: | |
| name: Release Artifacts on Linux | |
| needs: | |
| - create-release | |
| strategy: | |
| matrix: | |
| box: | |
| - { runner: ubuntu-24.04, arch: amd64 } | |
| - { runner: arm-runner, arch: arm64 } | |
| runs-on: ${{ matrix.box.runner }} | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends curl build-essential libssl-dev pkg-config | |
| - name: Install Rust Toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| - uses: actions/checkout@v4 | |
| - name: Build and Package | |
| run: | | |
| cd cli | |
| cargo build --release | |
| # Build gzip package | |
| cd ./target/release && tar -czvf dbdev.tar.gz ./dbdev | |
| cd ../.. | |
| # Build debian package | |
| package_dir="dbdev-${{ github.ref_name }}-linux-${{ matrix.box.arch }}" | |
| mkdir -p "${package_dir}/usr/local/bin" | |
| cp ./target/release/dbdev "${package_dir}/usr/local/bin/dbdev" | |
| extension_version="${{ github.ref_name }}" | |
| # strip the leading v | |
| deb_version="${extension_version:1}" | |
| mkdir -p "${package_dir}/DEBIAN" | |
| touch "${package_dir}/DEBIAN/control" | |
| echo 'Package: dbdev' >> ${package_dir}/DEBIAN/control | |
| echo 'Version:' ${deb_version} >> ${package_dir}/DEBIAN/control | |
| echo 'Architecture: ${{ matrix.box.arch }}' >> ${package_dir}/DEBIAN/control | |
| echo 'Maintainer: supabase' >> ${package_dir}/DEBIAN/control | |
| echo 'Description: CLI for publishing to database.dev' >> ${package_dir}/DEBIAN/control | |
| # Create deb package | |
| sudo chmod -R 00755 "${package_dir}" | |
| sudo dpkg-deb --build "${package_dir}" | |
| - name: Upload gzip Package | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| UPLOAD_URL: ${{ needs.create-release.outputs.upload_url }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ env.UPLOAD_URL }} | |
| asset_path: ./cli/target/release/dbdev.tar.gz | |
| asset_name: dbdev-${{ github.ref_name }}-linux-${{ matrix.box.arch }}.tar.gz | |
| asset_content_type: application/gzip | |
| - name: Upload Debian Package | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| UPLOAD_URL: ${{ needs.create-release.outputs.upload_url }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ env.UPLOAD_URL }} | |
| asset_path: ./cli/dbdev-${{ github.ref_name }}-linux-${{ matrix.box.arch }}.deb | |
| asset_name: dbdev-${{ github.ref_name }}-linux-${{ matrix.box.arch }}.deb | |
| asset_content_type: application/vnd.debian.binary-package | |
| build-macos: | |
| name: Release Artifacts on macOS | |
| needs: | |
| - create-release | |
| runs-on: macos-15 | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Install Rust Toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| - uses: actions/checkout@v4 | |
| - name: Build and Package | |
| run: | | |
| cd cli | |
| cargo build --release | |
| cd ./target/release && tar -czvf dbdev.tar.gz ./dbdev | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| UPLOAD_URL: ${{ needs.create-release.outputs.upload_url }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ env.UPLOAD_URL }} | |
| asset_path: ./cli/target/release/dbdev.tar.gz | |
| asset_name: dbdev-${{ github.ref_name }}-macos-amd64.tar.gz | |
| asset_content_type: application/${{ matrix.box.content-type }} | |
| build-windows: | |
| name: Release Artifacts on Windows | |
| needs: | |
| - create-release | |
| runs-on: windows-2022 | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Install Rust Toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| - uses: actions/checkout@v4 | |
| - name: Build and Package | |
| run: | | |
| cd cli | |
| cargo build --release | |
| cd ./target/release && Compress-Archive -Path ./dbdev.exe -Destination dbdev.zip | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| UPLOAD_URL: ${{ needs.create-release.outputs.upload_url }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ env.UPLOAD_URL }} | |
| asset_path: ./cli/target/release/dbdev.zip | |
| asset_name: dbdev-${{ github.ref_name }}-windows-amd64.zip | |
| asset_content_type: application/zip |