name: "Build and deploy website" on: push: branches: - main paths-ignore: - .gitignore - README.md - LICENSE # Allow one concurrent deployment concurrency: group: "blog" cancel-in-progress: true jobs: build-push: name: Build and Push Hugo Site runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 # Build and test site - name: Cache Hugo resources uses: actions/cache@v4 env: cache-name: cache-hugo-resources with: path: resources key: ${{ env.cache-name }} - uses: actions/setup-go@v5 with: go-version: "^1.17.0" - run: go version - name: Setup Hugo uses: https://github.com/peaceiris/actions-hugo@v2 with: hugo-version: "latest" extended: true - name: Build run: hugo --minify --gc - name: Copy website to destination server uses: https://github.com/garygrossgarten/github-action-scp@release with: local: public remote: /srv/docker/nginx/html/blog host: ${{ secrets.SSH_HOST }} port: ${{ secrets.SSH_PORT }} username: ${{ secrets.SSH_USER }} privateKey: ${{ secrets.SSH_PRIVATE_KEY }} rmRemote: true