Skip to content

Deploy

Deploy #6088

Workflow file for this run

name: Deploy
on:
schedule:
- cron: '*/6 * * * *'
workflow_dispatch:
jobs:
check-deploy-needed:
runs-on: ubuntu-latest
outputs:
is-deploy-needed: ${{ steps.flag-store.outputs.deploy-flag }}
steps:
- name: Store deploy flag to output
id: flag-store
run: |
echo "deploy-flag=${{ env.DEPLOY_FLAG }}" >> "$GITHUB_OUTPUT"
deploy:
runs-on: ubuntu-latest
needs: check-deploy-needed
if: ${{ needs.check-deploy-needed.outputs.is-deploy-needed == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies and build
run: |
npm install
npm run build
- name: Setup SSH
run: |
mkdir -p ~/.ssh/
echo "${{ secrets.SERVER_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
echo "${{ secrets.SERVER_SSH_PUBLIC_KEY }}" > ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa.pub
ssh-keyscan -H ${{ secrets.SERVER_SSH_IP }} >> ~/.ssh/known_hosts
- name: Deploy builds to server
run: |
rsync -vrm build/* ${{ secrets.SERVER_SSH_USERNAME }}@${{ secrets.SERVER_SSH_IP }}:~/test/
mark-deploy-done:
needs: deploy
runs-on: ubuntu-latest
steps:
- run: |
echo "DEPLOY_FLAG=false" >> $GITHUB_ENV