Skip to content

Deploy to git.mari.zip #82

Deploy to git.mari.zip

Deploy to git.mari.zip #82

Workflow file for this run

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