Skip to content

Commit

Permalink
chore: Retry Workflows on Failure in Publish or Builds on Branch main (
Browse files Browse the repository at this point in the history
  • Loading branch information
hrzlgnm authored Nov 2, 2024
1 parent 8f3d605 commit 24bf73a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,13 @@ jobs:
with:
subject-path: |
src-tauri/gen/android/app/build/outputs/apk/universal/release/mdns-browser_v${{ steps.get-version.outputs.current-version }}.apk
retry-on-failure:
if: ${{ failure() && fromJSON(github.run_attempt) < 3 && (inputs.publish || github.ref == 'refs/heads/main') }}
needs: [build]
runs-on: ubuntu-latest
steps:
- env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: gh workflow run retry-workflow.yml -F run_id=${{ github.run_id }}
12 changes: 11 additions & 1 deletion .github/workflows/desktop-tauri.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ jobs:
target/**/release/mdns-browser*
- name: 🛡️ Attest build provenance (publish release only)
if: (inputs.tagName != '')
if: inputs.tagName != ''
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3
with:
subject-path: |
Expand Down Expand Up @@ -183,3 +183,13 @@ jobs:
(contains(matrix.os, 'macos') && contains(matrix.args, 'aarch64')) && 'target/aarch64-apple-darwin/release/mdns-browser'
}}
sbom-path: "sbom.spdx.json"

retry-on-failure:
if: ${{ failure() && fromJSON(github.run_attempt) < 3 && (inputs.tagName != '' || github.ref == 'refs/heads/main') }}
needs: [build]
runs-on: ubuntu-latest
steps:
- env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: gh workflow run retry-workflow.yml -F run_id=${{ github.run_id }}
19 changes: 19 additions & 0 deletions .github/workflows/retry-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Retry workflow

on:
workflow_dispatch:
inputs:
run_id:
required: true

jobs:
rerun:
runs-on: ubuntu-latest
steps:
- name: rerun ${{ inputs.run_id }}
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: |
gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
gh run rerun ${{ inputs.run_id }} --failed

0 comments on commit 24bf73a

Please sign in to comment.