Skip to content

Commit 52be752

Browse files
committed
deploy: define the base URL as an environment variable
This will make a subsequent patch easier to understand, where we work around a misconfiguration of git-scm.com that won't let us enforce HTTPS in the GitHub UI at https://github.com/git/git-scm.com/settings/pages. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 4be6590 commit 52be752

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.github/actions/deploy-to-github-pages/action.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ runs:
4747
set -x &&
4848
echo "HUGO_VERSION=$(sed -n 's/^ *hugo_version: *//p' <hugo.yml)" >>$GITHUB_ENV
4949
echo "PAGEFIND_VERSION=$(sed -n 's/^ *pagefind_version: *//p' <hugo.yml)" >>$GITHUB_ENV
50+
echo "BASE_URL=${{ steps.pages.outputs.base_url }}" >>$GITHUB_ENV
5051
5152
- name: install Hugo ${{ env.HUGO_VERSION }}
5253
shell: bash
@@ -59,7 +60,7 @@ runs:
5960
env:
6061
HUGO_RELATIVEURLS: false
6162
shell: bash
62-
run: hugo config && hugo --baseURL "${{ steps.pages.outputs.base_url }}/"
63+
run: hugo config && hugo --baseURL "$BASE_URL/"
6364

6465
- name: run Pagefind ${{ env.PAGEFIND_VERSION }} to build the search index
6566
shell: bash
@@ -110,13 +111,12 @@ runs:
110111
id: remap
111112
shell: bash
112113
run: |
113-
base_url='${{ steps.pages.outputs.base_url }}'
114-
echo "result=$(echo "$base_url" |
114+
echo "result=$(echo "$BASE_URL" |
115115
sed 's|^\(.*\)\(/git-scm\.com\)$|(\1)?\2(.*)|') file://$PWD/public\$2" \
116116
>>$GITHUB_OUTPUT
117117
# When running in forks, do detect when links try to break out of the
118118
# `/git-scm.com/` subdirectory
119-
echo "remap-dotdot=$(echo "$base_url" |
119+
echo "remap-dotdot=$(echo "$BASE_URL" |
120120
sed -n 's|^\(https\?:\/\/.*\)\(/git-scm\.com\)$|--remap '\''(\1.*) file://../$1'\''|p')" \
121121
>>$GITHUB_OUTPUT
122122
@@ -127,7 +127,7 @@ runs:
127127
args: >-
128128
--offline
129129
--fallback-extensions html
130-
--base '${{ steps.pages.outputs.base_url }}'
130+
--base '$BASE_URL'
131131
--remap '${{ steps.remap.outputs.result }}'
132132
${{ steps.remap.outputs.remap-dotdot }}
133133
--exclude file:///path/to/repo.git/
@@ -199,9 +199,8 @@ runs:
199199
- name: Run Playwright tests
200200
shell: bash
201201
id: playwright
202-
env:
203-
PLAYWRIGHT_TEST_URL: ${{ steps.pages.outputs.base_url }}
204202
run: |
203+
PLAYWRIGHT_TEST_URL="$BASE_URL"
205204
# avoid test failures when HTTPS is enforced half-way through
206205
case "$PLAYWRIGHT_TEST_URL" in
207206
https://*|http://git-scm.com) ;; # okay, leave as-is

0 commit comments

Comments
 (0)