From 2e4f327593fb44fa05b6f50028c856546037a591 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Fri, 7 Feb 2025 10:18:45 +0100 Subject: [PATCH 1/4] switch to `actions/deploy-pages` introducing a two-step build, replacing `peaceiris/actions-gh-pages` and longer deploy to a branch --- .github/workflows/gh-pages.yml | 44 +++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 0ec8615f05..7664c85a93 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -2,47 +2,57 @@ name: GitHub Pages on: push: - branches: + branches: # TODO: Decide which branches to build + - main - develop + - deploy-pages + workflow_dispatch: jobs: + # BUILD build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - # with: - # submodules: true - + - name: Setup Pages + uses: actions/configure-pages@v5 - name: Setup Hugo uses: peaceiris/actions-hugo@v3 with: hugo-version: '0.133.0' - # extended: true - - uses: actions/setup-node@v4 with: node-version: 22 cache: 'npm' cache-dependency-path: package-lock.json - - - name: Install Tools run: npm install -g postcss-cli autoprefixer - - name: NPM install run: | npm config set "@skymatic:registry" https://npm.pkg.github.com/ npm config set '//npm.pkg.github.com/:_authToken' "${{ secrets.FONTAWESOME_AUTH_TOKEN }}" npm install - - name: Build run: hugo - - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./public - publish_branch: main - cname: cryptomator.org + path: 'public' + + # DEPLOY + deploy: + if: github.ref == 'refs/heads/main' + name: Deploy to GitHub Pages + runs-on: ubuntu-latest + needs: [build] + permissions: # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action + environment: # Deploy to the github-pages environment + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} \ No newline at end of file From 8640765acaf7b4b3d326a6f23aad2d217356ff9d Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Fri, 7 Feb 2025 10:19:35 +0100 Subject: [PATCH 2/4] run on feature branch --- .github/workflows/gh-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 7664c85a93..566fc0c74b 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -5,7 +5,7 @@ on: branches: # TODO: Decide which branches to build - main - develop - - deploy-pages + - feature/deploy-pages workflow_dispatch: jobs: From be8913c8be25c3687fc08fb0f94d2586428fe476 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Fri, 7 Feb 2025 10:28:26 +0100 Subject: [PATCH 3/4] use env var for npm registry authentication --- .github/workflows/gh-pages.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 566fc0c74b..2f25a09e60 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -26,13 +26,15 @@ jobs: node-version: 22 cache: 'npm' cache-dependency-path: package-lock.json + registry-url: 'https://npm.pkg.github.com/' - name: Install Tools run: npm install -g postcss-cli autoprefixer - name: NPM install run: | npm config set "@skymatic:registry" https://npm.pkg.github.com/ - npm config set '//npm.pkg.github.com/:_authToken' "${{ secrets.FONTAWESOME_AUTH_TOKEN }}" - npm install + npm ci --ignore-scripts + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build run: hugo - name: Upload artifact From 175f1e9b5adcff571062092481fb248e9469f0c3 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Fri, 7 Feb 2025 10:49:01 +0100 Subject: [PATCH 4/4] only build "on push" on every branch --- .github/workflows/gh-pages.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 2f25a09e60..da5a2d66c0 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -2,11 +2,6 @@ name: GitHub Pages on: push: - branches: # TODO: Decide which branches to build - - main - - develop - - feature/deploy-pages - workflow_dispatch: jobs: # BUILD