Deploy on Webhook #20
This file contains 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: Deploy on Webhook | |
on: | |
workflow_run: | |
workflows: | |
- "Python Lint" | |
- "Run tests" | |
types: | |
- completed | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download lint result | |
uses: actions/download-artifact@v2 | |
with: | |
name: lint-result | |
path: . | |
- name: Download test result | |
uses: actions/download-artifact@v2 | |
with: | |
name: test-result | |
path: . | |
- name: Check lint and test results | |
run: | | |
if [[ -f lint_result.txt && -f test_result.txt ]]; then | |
echo "Both lint and test succeeded." | |
else | |
echo "Skipping deployment as either lint or test did not pass." | |
exit 1 | |
fi | |
- name: Trigger Deployment Webhook | |
if: success() | |
env: | |
WEBHOOK_DOMAIN: ${{ secrets.WEBHOOK_DOMAIN }} | |
WEBHOOK_TOKEN: ${{ secrets.WEBHOOK_TOKEN }} | |
run: | | |
curl -X POST https://${{ secrets.WEBHOOK_DOMAIN }}/webhook/deploy -H "Authorization: Bearer ${{ secrets.WEBHOOK_TOKEN }}" |