pokerogue/.github/workflows/deploy.yml

34 lines
1.3 KiB
YAML

name: Deploy
on:
repository_dispatch:
types: [deploy-ssh]
jobs:
deploy:
runs-on: ubuntu-latest
env:
ARTIFACT_NAME: ${{ github.event.client_payload.artifact-name }}
ARTIFACT_URL: ${{ github.event.client_payload.artifact-url }}
steps:
- name: Deploy via SSH
id: deploy
uses: appleboy/ssh-action@029f5b4aeeeb58fdfe1410a5d17f967dacf36262 # v1.0.3
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd ${{ secrets.TMP_DIR }}
wget -O "${{ env.ARTIFACT_NAME }}.zip" --header="Authorization: token ${{ github.token }}" ${{ env.ARTIFACT_URL }}
unzip -aDo "${{ env.ARTIFACT_NAME }}.zip" -d "${{ env.ARTIFACT_NAME }}"
rsync -vR --delete "${{ env.ARTIFACT_NAME }}/" "${{ secrets.DESTINATION_DIR }}"
rm -rf "./${{ env.ARTIFACT_NAME }}.zip" "./${{ env.ARTIFACT_NAME }}"
- name: Purge Cloudflare Cache
id: purge-cache
uses: NathanVaughn/actions-cloudflare-purge@f70c63827b539cf48eb3a29fdaa7547eca4dede4 #latest commit at the time
with:
cf_auth: ${{ secrets.CLOUDFLARE_API_TOKEN }}
cf_zone: ${{ secrets.CLOUDFLARE_ZONE_ID }}