88 steps :
99 - uses : actions/checkout@v4
1010
11- - uses : ilyvion-contrib/container-ci -build@main
11+ - uses : ilyvion-contrib/ci-utils/container -build@main
1212 with :
1313 image : questionablextensions
1414
@@ -22,70 +22,50 @@ jobs:
2222 deploy :
2323 runs-on : ubuntu-latest
2424 needs : build
25- outputs :
26- deployment_id : ${{ steps.create_deployment.outputs.deployment_id }}
25+ env :
26+ GH_TOKEN : ${{ github.token }}
2727 if : github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
2828 steps :
29- - name : Create Deployment
30- id : create_deployment
31- run : |
32- deployment_response=$(curl -fsS -X POST \
33- -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
34- -H "Accept: application/vnd.github+json" \
35- https://api.github.com/repos/${{ github.repository }}/deployments \
36- -d '{
37- "ref": "${{ github.sha }}",
38- "environment": "staging",
39- "auto_merge": false,
40- "required_contexts": [],
41- "description": "Deploying to staging"
42- }')
43- deployment_id=$(echo "$deployment_response" | jq -r '.id')
44- echo "deployment_id=$deployment_id" >> "$GITHUB_OUTPUT"
45-
46- curl -fsS -X POST \
47- -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
48- -H "Accept: application/vnd.github+json" \
49- https://api.github.com/repos/${{ github.repository }}/deployments/${deployment_id}/statuses \
50- -d '{"state": "in_progress"}'
29+ - uses : ilyvion-contrib/ci-utils/create-deployment@main
30+ id : deployment
31+ with :
32+ ref : ${{ github.ref }}
33+ sha : ${{ github.sha }}
34+ environment : " staging"
5135
5236 - name : Download artifact
5337 uses : actions/download-artifact@v4
5438 with :
5539 name : questionablextensions-tar
5640
57- - uses : ilyvion-contrib/container- ci-deploy @main
41+ - uses : ilyvion-contrib/ci-utils/setup-ssh @main
5842 with :
5943 ssh_known_hosts : ${{ secrets.deploy_known_hosts }}
6044 ssh_private_key : ${{ secrets.deploy_key }}
45+ ssh_host : ${{ secrets.deploy_target }}
46+ ssh_port : ${{ secrets.deploy_port }}
47+
48+ - uses : ilyvion-contrib/ci-utils/container-deploy@main
49+ with :
6150 ssh_user : ${{ secrets.deploy_user }}
6251 ssh_host : ${{ secrets.deploy_target }}
6352 ssh_port : ${{ secrets.deploy_port }}
6453 image : questionablextensions
65-
66- - name : Update Deployment Status
54+
55+ - name : Mark deployment as success
56+ if : success()
6757 run : |
68- curl -X POST \
69- -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
58+ gh api \
59+ -X POST \
7060 -H "Accept: application/vnd.github+json" \
71- https://api.github.com/repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.deployment_id }}/statuses \
72- -d '{
73- "state": "success",
74- "description": "Deployment succeeded"
75- }'
76-
77- report-failure :
78- runs-on : ubuntu-latest
79- needs : deploy
80- if : failure()
81- steps :
82- - name : Report failure to GitHub Deployment
61+ repos/${{ github.repository }}/deployments/${{ steps.deployment.outputs.deployment_id }}/statuses \
62+ -f state="success"
63+
64+ - name : Mark deployment as failure
65+ if : failure()
8366 run : |
84- curl -sSL -X POST \
85- -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
86- -H "Accept: application/vnd.github+json" \
87- https://api.github.com/repos/${{ github.repository }}/deployments/${{ needs.deploy.outputs.deployment_id }}/statuses \
88- -d '{
89- "state": "failure",
90- "description": "Deployment failed"
91- }'
67+ gh api \
68+ -X POST \
69+ -H "Accept: application/vnd.github+json" \
70+ repos/${{ github.repository }}/deployments/${{ steps.deployment.outputs.deployment_id }}/statuses \
71+ -f state="failure"
0 commit comments