Kickoff deploy #72
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: Kickoff deploy | |
on: | |
workflow_run: | |
workflows: ["Build and test"] | |
branches: [ main ] | |
types: [completed] | |
jobs: | |
dispatch-deploy: | |
runs-on: "ubuntu-latest" | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
# - name: Repository Dispatch | |
# uses: peter-evans/repository-dispatch@v3 | |
# with: | |
# token: ${{ secrets.DEPLOY_PAT }} | |
# repository: pretagov/deploy-helm | |
# event-type: deploy | |
- name: Workflow Dispatch | |
run: | | |
http_response=$(curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.DEPLOY_PAT }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/pretagov/deploy-helm/actions/workflows/deploy-to-k8s.yaml/dispatches \ | |
-d '{"ref":"main","inputs":{}}' \ | |
-o response.txt -w "%{response_code}") | |
if [ $http_response != "204" ]; then | |
exit 1 | |
else | |
echo "Server returned:" | |
cat response.txt | |
fi |