This file contains hidden or 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: Build and Deploy Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Build static site | |
| run: yarn build | |
| - name: Upload static files via rsync | |
| uses: appleboy/ssh-action@v0.1.10 | |
| with: | |
| host: ${{ secrets.SERVER_HOST }} | |
| username: ${{ secrets.SERVER_USER }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| script: | | |
| mkdir -p /var/www/zennodroid-docs | |
| env: | |
| RSYNC_RSH: "ssh -o StrictHostKeyChecking=no" | |
| - name: Deploy with rsync | |
| run: | | |
| rsync -avz --delete -e "ssh -o StrictHostKeyChecking=no -i $PRIVATE_KEY" ./build/ $USER@$HOST:/var/www/zennodroid-docs | |
| env: | |
| PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
| USER: ${{ secrets.SERVER_USER }} | |
| HOST: ${{ secrets.SERVER_HOST }} | |
| - name: Reload Angie | |
| uses: appleboy/ssh-action@v0.1.10 | |
| with: | |
| host: ${{ secrets.SERVER_HOST }} | |
| username: ${{ secrets.SERVER_USER }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| script: sudo systemctl reload angie |