feat: update git workflow #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Deploy GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| env: | |
| HUGO_VERSION: "0.148.2" | |
| PUBLISH_DIR: "./public" | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Configure GitHub Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Set up Hugo | |
| uses: peaceiris/actions-hugo@v2 | |
| with: | |
| hugo-version: ${{ env.HUGO_VERSION }} | |
| extended: true | |
| - name: Install dependencies | |
| run: sudo apt-get update && sudo apt-get install -y make curl | |
| - name: Build site | |
| run: make build | |
| - name: Copy CNAME | |
| run: | | |
| if [ -f CNAME ]; then | |
| cp CNAME ${{ env.PUBLISH_DIR }}/ | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ${{ env.PUBLISH_DIR }} | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |