Github Actions to build & deploy this blog
2022, May, 30
Code
Previously I was trying to run the build of this blog on my own server using Github webhook.
But my puny server was having a hard time handling the spike in resource usage during npm install
I found a nice guide to using github actions to build and push to a linux server.
name: deployon: push: branches: - mainjobs: build-and-deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 - run: npm install -g @gridsome/cli - run: npm install - run: gridsome build - name: Install SSH Key uses: shimataro/ssh-key-action@v2 with: key: ${{ secrets.SSH_KEY }} known_hosts: unnecessary - name: Adding Known Hosts run: ssh-keyscan -p ${{ secrets.PORT}} -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts - name: Deploy with rsync run: rsync -avz -e "ssh -p ${{ secrets.PORT}}" ./dist/ ${{ secrets.SSH_USER }}@${{ secrets.HOST }}:${{ secrets.DEST }}