Skip to content

Commit

Permalink
fix: use base_path for github pages static build
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-bouvier committed Jul 29, 2024
1 parent 106718c commit a83a47e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 51 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

# https://github.com/actions/configure-pages/blob/main/action.yml
# Expose output variables : base_url, origin, host, base_path
# Those are accessible prefixed by "steps.deployment.outputs."
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
Expand All @@ -59,10 +62,9 @@ jobs:
run: npm install

- name: Build static site
run: npm run build -- --pathprefix="${{ steps.deployment.outputs.page_url }}/"
run: npm run build -- --pathprefix="${{ steps.deployment.outputs.base_path }}/"

- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v3
with:
path: ./_site
Expand Down
50 changes: 1 addition & 49 deletions Making-of.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,60 +359,12 @@ First I will create a git branch named `gh-pages`

.github/workflows/deploy-to-ghpages.yml

{% comment %}
TODO: find a way to show this file properly in both the text and rendered.

```yaml
name: Deploy to GitHub Pages

on:
push:
branches:
- main
pull_request:

jobs:
deploy:
runs-on: ubuntu-22.04
permissions:
contents: write
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
steps:
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Persist npm cache
uses: actions/cache@v4
with:
path: ~/.npm
key: "${{ runner.os }}-node-${{ hashFiles('**/package.json') }}"

- name: Persist Eleventy .cache
uses: actions/cache@v4
with:
path: ./.cache
key: ${{ runner.os }}-eleventy-fetch-cache

- name: Install dependencies
run: npm install

- name: Build static site
run: npm run build

- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site

```
{% endcomment %}



## Next time
Expand Down

0 comments on commit a83a47e

Please sign in to comment.