deploy-website #61
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: deploy-website | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '.git**' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: "${{ secrets.SSH_PRIVATE_KEY }}" | |
name: id_ed25519 | |
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} | |
- name: Checkout website | |
uses: actions/checkout@master | |
with: | |
path: exult-web-master | |
- name: Upload and update website | |
shell: bash | |
run: | | |
cd $GITHUB_WORKSPACE | |
zip -9 master.zip -r exult-web-master | |
(for ii in $(seq 1 5); do scp -o BatchMode=yes -o PasswordAuthentication=no -i ~/.ssh/id_ed25519 master.zip ${{ secrets.SCP_HOST }}:${{ secrets.PROJECT_HOME }} && exit 0 || true; done; exit 255) | |
(for ii in $(seq 1 5); do ssh -o BatchMode=yes -o PasswordAuthentication=no -i ~/.ssh/id_ed25519 ${{ secrets.SSH_HOST }} create && exit 0 || true; done; exit 255) | |
(for ii in $(seq 1 5); do ssh -o BatchMode=yes -o PasswordAuthentication=no -i ~/.ssh/id_ed25519 ${{ secrets.SSH_HOST }} "cd ${{ secrets.PROJECT_HOME }}; ./update.sh" && exit 0 || true; done; exit 255) | |
(for ii in $(seq 1 5); do ssh -o BatchMode=yes -o PasswordAuthentication=no -i ~/.ssh/id_ed25519 ${{ secrets.SSH_HOST }} shutdown && exit 0 || true; done; exit 255) |