Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/actions/deploy-to-github-pages/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ runs:
set -x &&
echo "HUGO_VERSION=$(sed -n 's/^ *hugo_version: *//p' <hugo.yml)" >>$GITHUB_ENV
echo "PAGEFIND_VERSION=$(sed -n 's/^ *pagefind_version: *//p' <hugo.yml)" >>$GITHUB_ENV
BASE_URL=${{ steps.pages.outputs.base_url }}
test http://git-scm.com != "$BASE_URL" || BASE_URL="https://${BASE_URL#http://}"
echo "BASE_URL=$BASE_URL" >>$GITHUB_ENV

- name: install Hugo ${{ env.HUGO_VERSION }}
shell: bash
Expand All @@ -59,7 +62,7 @@ runs:
env:
HUGO_RELATIVEURLS: false
shell: bash
run: hugo config && hugo --baseURL "${{ steps.pages.outputs.base_url }}/"
run: hugo config && hugo --baseURL "$BASE_URL/"

- name: run Pagefind ${{ env.PAGEFIND_VERSION }} to build the search index
shell: bash
Expand Down Expand Up @@ -110,13 +113,12 @@ runs:
id: remap
shell: bash
run: |
base_url='${{ steps.pages.outputs.base_url }}'
echo "result=$(echo "$base_url" |
echo "result=$(echo "$BASE_URL" |
sed 's|^\(.*\)\(/git-scm\.com\)$|(\1)?\2(.*)|') file://$PWD/public\$2" \
>>$GITHUB_OUTPUT
# When running in forks, do detect when links try to break out of the
# `/git-scm.com/` subdirectory
echo "remap-dotdot=$(echo "$base_url" |
echo "remap-dotdot=$(echo "$BASE_URL" |
sed -n 's|^\(https\?:\/\/.*\)\(/git-scm\.com\)$|--remap '\''(\1.*) file://../$1'\''|p')" \
>>$GITHUB_OUTPUT

Expand All @@ -127,7 +129,7 @@ runs:
args: >-
--offline
--fallback-extensions html
--base '${{ steps.pages.outputs.base_url }}'
--base '$BASE_URL'
--remap '${{ steps.remap.outputs.result }}'
${{ steps.remap.outputs.remap-dotdot }}
--exclude file:///path/to/repo.git/
Expand Down Expand Up @@ -199,9 +201,8 @@ runs:
- name: Run Playwright tests
shell: bash
id: playwright
env:
PLAYWRIGHT_TEST_URL: ${{ steps.pages.outputs.base_url }}
run: |
PLAYWRIGHT_TEST_URL="$BASE_URL"
# avoid test failures when HTTPS is enforced half-way through
case "$PLAYWRIGHT_TEST_URL" in
https://*|http://git-scm.com) ;; # okay, leave as-is
Expand Down
Loading