new post #978
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: Deploy Site | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'source/**' | |
| - 'themes/**' | |
| - '_config.yml' | |
| - '_config.butterfly.yml' | |
| workflow_dispatch: | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '21.7.1' | |
| cache: 'npm' | |
| cache-dependency-path: '**/package-lock.json' | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Generate Static Files | |
| run: npm run b | |
| - name: Set up SSH key | |
| uses: webfactory/ssh-agent@v0.9.0 | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Deploy to Server | |
| run: | | |
| ssh-keyscan -p 22 -H ${{ vars.SERVER_IP }} >> ~/.ssh/known_hosts | |
| rsync -avz --delete -e "ssh -p 22" ./public/ root@${{ vars.SERVER_IP }}:/var/www/blog/ | |
| - name: Deploy to gh-pages | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: gh-pages | |
| folder: public |