Build and Release Homebrew Binaries #4
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: Build and Release Homebrew Binaries | |
| # Builds native binaries for all Dart-supported platforms and creates a GitHub | |
| # Release when a version tag is pushed. The GitHub Release triggers | |
| # chocolatey.yml (Chocolatey publish) and homebrew-formula-update.yaml runs in | |
| # parallel to update the Homebrew tap formula. | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to build from' | |
| required: true | |
| type: string | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| target: macos-arm64 | |
| dart-arch: arm64 | |
| binary-ext: '' | |
| - os: macos-15-intel | |
| target: macos-x64 | |
| dart-arch: x64 | |
| binary-ext: '' | |
| - os: ubuntu-latest | |
| target: linux-x64 | |
| dart-arch: x64 | |
| binary-ext: '' | |
| - os: ubuntu-24.04-arm | |
| target: linux-arm64 | |
| dart-arch: arm64 | |
| binary-ext: '' | |
| - os: windows-latest | |
| target: windows-x64 | |
| dart-arch: x64 | |
| binary-ext: .exe | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.tag || github.ref }} | |
| - name: Setup Dart | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| architecture: ${{ matrix.dart-arch }} | |
| - name: Install dependencies | |
| run: dart pub get | |
| - name: Compile binary | |
| run: dart compile exe packages/obs_cli/bin/obs.dart -o obs-cli-${{ matrix.target }}${{ matrix.binary-ext }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: obs-cli-${{ matrix.target }} | |
| path: obs-cli-${{ matrix.target }}${{ matrix.binary-ext }} | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Prepare binaries for release | |
| run: | | |
| mkdir -p release | |
| # macOS | |
| cp artifacts/obs-cli-macos-arm64/obs-cli-macos-arm64 release/obs-cli-darwin-arm64 | |
| cp artifacts/obs-cli-macos-x64/obs-cli-macos-x64 release/obs-cli-darwin-amd64 | |
| # Linux | |
| cp artifacts/obs-cli-linux-x64/obs-cli-linux-x64 release/obs-cli-linux-amd64 | |
| cp artifacts/obs-cli-linux-arm64/obs-cli-linux-arm64 release/obs-cli-linux-arm64 | |
| # Windows (dart compile exe auto-appends .exe on Windows) | |
| cp artifacts/obs-cli-windows-x64/obs-cli-windows-x64.exe release/obs-cli-windows-amd64.exe | |
| chmod +x release/obs-cli-darwin-* release/obs-cli-linux-* | |
| - name: Generate SHA256 checksums | |
| run: | | |
| cd release | |
| shasum -a 256 * > checksums.txt | |
| cat checksums.txt | |
| - name: Create/Update Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.tag || github.ref_name }} | |
| files: | | |
| release/obs-cli-darwin-arm64 | |
| release/obs-cli-darwin-amd64 | |
| release/obs-cli-linux-amd64 | |
| release/obs-cli-linux-arm64 | |
| release/obs-cli-windows-amd64.exe | |
| release/checksums.txt | |
| generate_release_notes: true | |
| draft: false |