Repository navigation
51 lines (44 loc) · 1.46 KB
/
Copy pathdeploy.yml
File metadata and controls
51 lines (44 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Deploy to git.mari.zip
on:
workflow_run:
workflows:
- Docker build
branches:
- main
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: ssh
uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2 # v1.2.5
with:
host: ${{ secrets.SSH_ADDRESS }}
port: ${{ secrets.SSH_PORT }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd ~/gitarena/
docker compose pull
docker compose up -d
- name: wait for deploy
run: sleep 5
- name: check if update succeeded
run: |
response=$(curl -sf https://api.git.mari.zip/api)
parsed=$(echo "$response" | jq)
echo "Curl response:" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
echo "$parsed" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
commit=$(echo "$response" | jq -r '.commit')
if [ "$commit" != "${{ github.event.workflow_run.head_sha }}" ]; then
echo "::error::hash mismatched."
echo "::error::deployed: $commit"
echo "::error::expected: ${{ github.event.workflow_run.head_sha }}"
exit 1
else
echo "hash matched. deploy success."
fi