|
| 1 | +name: Publish to Homebrew & Scoop Repositories |
| 2 | + |
| 3 | +on: |
| 4 | + # Automatic trigger after release workflow completes |
| 5 | + workflow_run: |
| 6 | + workflows: ["Build and Publish Release Packages"] |
| 7 | + types: |
| 8 | + - completed |
| 9 | + # Manual trigger for testing |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + version: |
| 13 | + description: "Wireport version (e.g. '0.9.1') to publish" |
| 14 | + required: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + dispatch: |
| 18 | + name: Dispatch update events |
| 19 | + runs-on: ubuntu-latest |
| 20 | + # Only run automatically if upstream workflow succeeded |
| 21 | + if: | |
| 22 | + (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || |
| 23 | + github.event_name == 'workflow_dispatch' |
| 24 | +
|
| 25 | + steps: |
| 26 | + - name: Determine release version |
| 27 | + id: vars |
| 28 | + run: | |
| 29 | + if [[ "${{ github.event_name }}" == "workflow_run" ]]; then |
| 30 | + REF="${{ github.event.workflow_run.head_branch }}" |
| 31 | + if [[ "$REF" == v* ]]; then |
| 32 | + VERSION="${REF#v}" |
| 33 | + else |
| 34 | + VERSION="$REF" |
| 35 | + fi |
| 36 | + else |
| 37 | + VERSION="${{ github.event.inputs.version }}" |
| 38 | + fi |
| 39 | + echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 40 | +
|
| 41 | + - name: Dispatch update to homebrew-wireport |
| 42 | + uses: peter-evans/repository-dispatch@v3 |
| 43 | + with: |
| 44 | + token: ${{ secrets.CROSS_REPO_PACKAGE_TOKEN }} |
| 45 | + repository: MultionLabs/homebrew-wireport |
| 46 | + event-type: update-formula |
| 47 | + client-payload: '{"version":"${{ steps.vars.outputs.version }}"}' |
| 48 | + |
| 49 | + - name: Dispatch update to scoop-wireport |
| 50 | + uses: peter-evans/repository-dispatch@v3 |
| 51 | + with: |
| 52 | + token: ${{ secrets.CROSS_REPO_PACKAGE_TOKEN }} |
| 53 | + repository: MultionLabs/scoop-wireport |
| 54 | + event-type: update-bucket |
| 55 | + client-payload: '{"version":"${{ steps.vars.outputs.version }}"}' |
0 commit comments