Skip to content

Commit

Permalink
build: simplify build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-bouvier committed Jul 29, 2024
1 parent c0b4774 commit ff5402d
Showing 1 changed file with 86 additions and 4 deletions.
90 changes: 86 additions & 4 deletions Making-of.md → making-of.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,95 @@ This file describes the various steps of a pipeline.

We can find templates specific to the GitHub Pages in the "Pages" category : https://github.com/marc-bouvier/green-a11y-11ty/actions/new?category=pages

First I will create a git branch named `gh-pages`
I will use Jekyll as a starter template and customize it for 11ty.

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

TODO: find a way to show this file properly in both the text and rendered.
.github/workflows/static.yml

```yaml
name: Deploy to GitHub Pages

on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
pull_request:


# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write


# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-22.04
permissions:
contents: write
concurrency:
group: "{{ '${{ github.workflow }}-${{ github.ref }}' | escape }}"
steps:

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

- 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.pages.outputs."
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5

- name: Persist npm cache
uses: actions/cache@v4
with:
path: ~/.npm
key: "{{ '${{ runner.os }}' | escape }}-node-{{ '${{' | escape }}hashFiles('**/package.json') {{'}}' | escape }}"
# {% comment %}
#
# key: "${{ runner.os }}-node-${{ hashFiles('**/package.json') }}"
# {% endcomment %}
- 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 -- --pathprefix={{ '${{ steps.pages.outputs.base_path }}' | escape }}

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site

deploy:
environment:
name: github-pages
url: {{'${{ steps.deployment.outputs.page_url }}' | escape }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

```

Expand Down

0 comments on commit ff5402d

Please sign in to comment.