From 94909b31b36fe6951378b7d9bbe4d9e1453d9b55 Mon Sep 17 00:00:00 2001 From: hksn111 Date: Fri, 3 Jan 2025 19:07:43 +0800 Subject: [PATCH] Update deploy.yml --- .github/workflows/deploy.yml | 98 +++++++----------------------------- 1 file changed, 19 insertions(+), 79 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2edb0b5..e7b7985 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,84 +1,24 @@ -name: Hugo build and deploy +name: Deploy with Hugo + on: push: - branches: [ main ] - paths: - - '.github/workflows/deploy.yml' - - 'assets/**' - - 'config/**' - - 'content/**' - - 'data/**' - - 'static/**' - - 'themes/**' - - 'go.mod' - - 'go.sum' - workflow_run: - workflows: ['Update theme'] - types: - - completed - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - + branches: + - main + jobs: - # Build job - build: + build-deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - 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: Cache Go Modules - uses: actions/cache@v4 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: Setup Hugo - uses: peaceiris/actions-hugo@v3 - with: - # use the environment variable HUGO_VERSION as the hugo version, if not set, use `latest`. - hugo-version: ${{ vars.HUGO_VERSION || 'latest' }} - extended: true - - name: Hugo build - run: hugo --gc --minify --logLevel info - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - # Upload only the public directory - path: './public' - - # Deployment job - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - uses: actions/checkout@v4 - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 + - uses: actions/checkout@v2 + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo_version: ${{ vars.HUGO_VERSION || 'latest' }} + extended: true + - name: Build Site + run: hugo + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.TOKEN }} + publish_dir: ./public