name: Deploy Hugo site to Pages on: push: branches: ["main"] workflow_dispatch: permissions: contents: read pages: write id-token: write concurrency: group: "pages" cancel-in-progress: false defaults: run: shell: bash jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Setup Hugo uses: peaceiris/actions-hugo@v2 with: hugo-version: '0.92.0' extended: true - name: Build run: hugo --minify - name: Setup Brotli run: | sudo apt-get update sudo apt-get install -y brotli - name: Compress files with Brotli run: | find public -type f -regex '.*\.\(html\|css\|js\|xml\|svg\|json\|txt\|md\|m3u8\|ts\)$' -exec brotli -f {} \; - name: Compress files with Gzip run: | find public -type f -regex '.*\.\(html\|css\|js\|xml\|svg\|json\|txt\|md\|m3u8\|ts\)$' -exec gzip -f -k {} \; - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: path: ./public deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2