From 77e6561b2d2e05c24cae141e08d8d11ae96aa87e Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Sat, 29 Jun 2024 17:50:53 +0200 Subject: [PATCH 1/2] Use GitHub action for deploying pages --- .github/workflows/gh-pages.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 02f7ad6..9d03401 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -7,12 +7,13 @@ on: pull_request: jobs: - deploy: + build: runs-on: ubuntu-24.04 concurrency: group: ${{ github.workflow }}-${{ github.ref }} permissions: - contents: write + #contents: write + contents: read steps: - uses: actions/checkout@v4 with: @@ -25,9 +26,22 @@ jobs: - name: Build run: hugo --minify - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - if: github.ref == 'refs/heads/main' + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./public \ No newline at end of file + path: ./public/ + + deploy: + ##if: ${{ github.ref == 'refs/heads/main' }} + needs: build + runs-on: ubuntu-24.04 + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From a575f3c6918b81763e5162357158c8d874d60cee Mon Sep 17 00:00:00 2001 From: kaklakariada Date: Sat, 29 Jun 2024 17:54:29 +0200 Subject: [PATCH 2/2] Deploy only on main branch --- .github/workflows/gh-pages.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 9d03401..2351f38 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -12,7 +12,6 @@ jobs: concurrency: group: ${{ github.workflow }}-${{ github.ref }} permissions: - #contents: write contents: read steps: - uses: actions/checkout@v4 @@ -32,7 +31,7 @@ jobs: path: ./public/ deploy: - ##if: ${{ github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' }} needs: build runs-on: ubuntu-24.04 permissions: