name: Reload Act Runner Stack to clear cache for workflows on: push: branches: [main] jobs: diff: uses: https://gitea.chromart.cc/martin/chromart-gitea-actions/.gitea/workflows/diff-output.yaml@main with: files: .gitea/** reload-primary: needs: diff if: ${{ needs.diff.outputs.is_changed == 'true' }} uses: https://gitea.chromart.cc/martin/chromart-gitea-actions/.gitea/workflows/gitainer-deploy.yaml@main with: stack_name: gitea_act_runner # the secondary runner executes the primary restart webhook runs_on_label: runner-secondary # We use a detached webhook call so primary doesn't hang if the Gitainer stack takes 5 minutes to rebuild, and it avoids bridge network drop edge cases delayed_silent: true wait-for-primary-death: needs: [diff, reload-primary] if: ${{ needs.diff.outputs.is_changed == 'true' }} runs-on: runner-secondary steps: - name: Wait for Gitainer to kill the secondary runner run: | echo "The detached webhook container sleeps for 10s before firing." echo "We wait 30s here to guarantee the webhook fired and Gitainer destroyed the old secondary runner." sleep 30 reload-secondary: needs: [diff, wait-for-primary-death] if: ${{ needs.diff.outputs.is_changed == 'true' }} # ensuring the primary actually survived and restarted successfully uses: https://gitea.chromart.cc/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 # We use a detached webhook call so primary doesn't hang if the Gitainer stack takes 5 minutes to rebuild, and it avoids bridge network drop edge cases delayed_silent: true wait-for-secondary-death: needs: [diff, reload-secondary] if: ${{ needs.diff.outputs.is_changed == 'true' }} runs-on: runner-primary steps: - name: Wait for Gitainer to kill the secondary runner run: | echo "The detached webhook container sleeps for 10s before firing." echo "We wait 30s here to guarantee the webhook fired and Gitainer destroyed the old secondary runner." sleep 30 pull-cache-secondary: needs: [diff, wait-for-secondary-death] if: ${{ needs.diff.outputs.is_changed == 'true' }} # Because the old secondary is dead, Gitea leaves this job in the queue until the NEW secondary runner boots up. uses: https://gitea.chromart.cc/martin/chromart-gitea-actions/.gitea/workflows/noop.yaml@main with: runs_on_label: runner-secondary