diff --git a/.gitea/workflows/pull-cache.yaml b/.gitea/workflows/pull-cache.yaml new file mode 100644 index 0000000..82d5208 --- /dev/null +++ b/.gitea/workflows/pull-cache.yaml @@ -0,0 +1,21 @@ +name: Pull Actions Cache +on: + workflow_call: + inputs: + runs_on_label: + description: The runner label to execute this workflow on. + required: false + type: string + default: ubuntu-22.04 + +jobs: + # This job does literally nothing but force the designated runner + # to clone/pull the chromart-gitea-actions repository into its worker cache. + # This is needed after a runner container is recreated or its cache is wiped. + pull-cache: + runs-on: ${{ inputs.runs_on_label }} + steps: + - name: Force actions clone + uses: martin/chromart-gitea-actions/.gitea/workflows/diff-output.yaml@main + with: + files: 'nonexistent-file-to-force-cache-pull' diff --git a/.gitea/workflows/reload-act-runner.yaml b/.gitea/workflows/reload-act-runner.yaml index 800633f..2c3d789 100644 --- a/.gitea/workflows/reload-act-runner.yaml +++ b/.gitea/workflows/reload-act-runner.yaml @@ -20,10 +20,27 @@ jobs: runs_on_label: runner-secondary reload-secondary: - needs: reload-primary + needs: [diff, reload-primary] + if: ${{ needs.diff.outputs.is_changed == 'true' }} # ensuring the primary actually survived and restarted successfully uses: martin/chromart-gitea-actions/.gitea/workflows/gitainer-deploy.yaml@main with: stack_name: gitea_act_runner_secondary # the primary runner executes the secondary restart webhook runs_on_label: runner-primary + + pull-cache-primary: + needs: [diff, reload-secondary] + if: ${{ needs.diff.outputs.is_changed == 'true' }} + # Use the primary runner (which is now done restarting secondary) to prove it's alive and pull cache + uses: martin/chromart-gitea-actions/.gitea/workflows/pull-cache.yaml@main + with: + runs_on_label: runner-primary + + pull-cache-secondary: + needs: [diff, pull-cache-primary] + if: ${{ needs.diff.outputs.is_changed == 'true' }} + # Use the secondary runner (which is now done restarting) to prove it's alive and pull cache + uses: martin/chromart-gitea-actions/.gitea/workflows/pull-cache.yaml@main + with: + runs_on_label: runner-secondary