Skip to content

Commit 8cb3129

Browse files
authored
Update pages-deploy.yml.hook (cotes2020#229)
This change will make the baseurl configuration/testing work. Previous version failed. Posts should have /index.html as suffix in my experience.
1 parent 4b1fd0a commit 8cb3129

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

.github/workflows/pages-deploy.yml.hook

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,25 @@ jobs:
4444
run: |
4545
baseurl="$(grep '^baseurl:' _config.yml | sed "s/.*: *//;s/['\"]//g;s/#.*//")"
4646
if [[ -n $baseurl ]]; then
47-
echo "SPEC_TEST=_site_no_baseurl" >> $GITHUB_ENV
47+
echo "BASE_URL=$baseurl" >> $GITHUB_ENV
4848
fi
4949

5050
- name: Build Site
5151
env:
5252
JEKYLL_ENV: production
5353
run: |
54-
bundle exec jekyll b
55-
56-
if [[ -n $SPEC_TEST ]]; then
57-
# Bypass the defects of htmlproofer
58-
bundle exec jekyll b -b "" -d "$SPEC_TEST"
59-
fi
54+
bundle exec jekyll b -d "_site$BASE_URL"
6055

6156
- name: Test Site
6257
run: |
63-
if [[ -n $SPEC_TEST ]]; then
64-
bash tools/test.sh -d "$SPEC_TEST"
65-
else
66-
bash tools/test.sh
67-
fi
58+
bash tools/test.sh
6859

6960
- name: Deploy
7061
run: |
62+
if [[ -n $BASE_URL ]]; then
63+
mv _site$BASE_URL _site-rename
64+
rm -rf _site
65+
mv _site-rename _site
66+
fi
67+
7168
bash tools/deploy.sh

0 commit comments

Comments
 (0)