name: hugo-deploy run-name: build and deploy hugo page on: push: branches: - main defaults: run: shell: bash jobs: deploy: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v4 with: node-version: '18.x' - run: npm ci - run: npm run build - uses: https://github.com/webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Add known host run: | mkdir -p ~/.ssh chmod 700 ~/.ssh echo "${{ secrets.KNOWN_HOST_KEY }}" > ~/.ssh/known_hosts - name: Deploy with rsync run: rsync -atv --delete --progress --checksum --whole-file -e ssh dist/ ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.DEPLOY_LOCATION }}