fix: migrate GitHub Actions from yarn to npm #31
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: '20.18.1' | |
| - name: Install Russian locale | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y locales | |
| sudo locale-gen ru_RU.UTF-8 | |
| sudo update-locale LANG=ru_RU.UTF-8 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build static site | |
| run: | | |
| export LANG=ru_RU.UTF-8 | |
| export LC_ALL=ru_RU.UTF-8 | |
| npm run 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: | | |
| echo "$PRIVATE_KEY" > key.pem | |
| chmod 600 key.pem | |
| rsync -avz --delete -e "ssh -i key.pem -o StrictHostKeyChecking=no" ./build/ $USER@$HOST:/var/www/zennodroid-docs | |
| rm key.pem | |
| 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 |