Add Homebrew tap repository dispatch to release workflow (#128) #177
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: CI | |
| on: | |
| workflow_dispatch: # Manual trigger runs all jobs | |
| pull_request: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup-dotnet | |
| - name: Test | |
| run: dotnet test ./tests/Keystone.Cli.UnitTests/Keystone.Cli.UnitTests.csproj -c Release | |
| changes: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| outputs: | |
| packaging: ${{ steps.filter.outputs.packaging }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| packaging: | |
| - 'src/**/*.csproj' | |
| - 'Directory.Build.props' | |
| - 'nfpm.yaml' | |
| - 'scripts/package-deb.sh' | |
| - 'scripts/verify-deb-install.sh' | |
| - 'tests/deb/**' | |
| build-deb: | |
| name: Build .deb (${{ matrix.arch }}) | |
| needs: changes | |
| if: needs.changes.outputs.packaging == 'true' || github.event_name == 'workflow_dispatch' | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-latest | |
| arch: amd64 | |
| rid: linux-x64 | |
| - runner: ubuntu-24.04-arm | |
| arch: arm64 | |
| rid: linux-arm64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup-dotnet | |
| - name: Publish | |
| env: | |
| RID: ${{ matrix.rid }} | |
| run: dotnet publish ./src/Keystone.Cli/Keystone.Cli.csproj -c Release -r "$RID" | |
| - name: Build .deb package | |
| uses: ./.github/actions/build-deb | |
| with: | |
| rid: ${{ matrix.rid }} | |
| - name: Upload .deb artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: deb-${{ matrix.rid }} | |
| path: artifacts/release/keystone-cli_*.deb | |
| if-no-files-found: error | |
| test-deb: | |
| name: Test .deb (${{ matrix.distro }}-${{ matrix.arch }}) | |
| needs: [changes, build-deb] | |
| if: needs.changes.outputs.packaging == 'true' || github.event_name == 'workflow_dispatch' | |
| runs-on: ${{ matrix.runner }} | |
| container: ${{ matrix.image }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-latest | |
| arch: amd64 | |
| rid: linux-x64 | |
| distro: debian | |
| image: debian:bookworm | |
| - runner: ubuntu-latest | |
| arch: amd64 | |
| rid: linux-x64 | |
| distro: ubuntu | |
| image: ubuntu:24.04 | |
| - runner: ubuntu-24.04-arm | |
| arch: arm64 | |
| rid: linux-arm64 | |
| distro: debian | |
| image: debian:bookworm | |
| - runner: ubuntu-24.04-arm | |
| arch: arm64 | |
| rid: linux-arm64 | |
| distro: ubuntu | |
| image: ubuntu:24.04 | |
| steps: | |
| - name: Checkout (for verify script) | |
| uses: actions/checkout@v6 | |
| with: | |
| sparse-checkout: scripts | |
| sparse-checkout-cone-mode: false | |
| - name: Download .deb artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: deb-${{ matrix.rid }} | |
| path: deb | |
| - name: Verify installation | |
| # SAFE_ARCH is the validated architecture; * is left unquoted for globbing and "$SAFE_ARCH" is quoted after the glob. | |
| env: | |
| ARCH: ${{ matrix.arch }} | |
| run: | | |
| SAFE_ARCH="$(./scripts/validate-arch.sh "$ARCH")" | |
| bash ./scripts/verify-deb-install.sh ./deb/keystone-cli_*_"$SAFE_ARCH".deb |