Skip to content

Commit

Permalink
build: set up build workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Wouter Termont <[email protected]>
  • Loading branch information
woutermont committed Dec 10, 2024
1 parent 569d588 commit 45643be
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/auto-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

##
# This workflow renders a new version of each changed spec for GitHub Pages.
##

name: GitHub Pages workflow

on:
push:
branches: [ main ]
workflow_dispatch: # for testing

env:
build_dir: _gh_pages_build

jobs:

conditional-build-deploy:
name: Build and deploy changed specs
runs-on: ubuntu-20.04
permissions:
contents: write
steps:

- name: Checkout branch
uses: actions/checkout@v4

- name: Detect changed specs
uses: dorny/paths-filter@v3
with:
base: ${{ github.ref }}
filters: |
level0: level0/**
# level1: level1/**
# level2: level2/**
id: filter

- name: Set Python version
uses: actions/setup-python@v5
with:
python-version: '>=3.9'

- name: Install Bikeshed
run: pipx install --python $(which python) --quiet bikeshed

- name: Setup build environment
run: |
mkdir -p "${{ env.build_dir }}"
cp common/* level0/
echo "time=$(date +"%Y%m%d%H%M%S")" >> "$GITHUB_OUTPUT"
# && cp common/* level1/ && cp common/* level2/

- name: Build Level 0
if: steps.filter.outputs.level0 == 'true'
run: bikeshed spec level0/index.bs "${{ env.build_dir }}/level0/index.html"
id: bikeshed

# - name: Build Level 1
# if: steps.filter.outputs.level1 == 'true'
# run: bikeshed spec level1/index.bs "${{ env.build_dir }}/level1/index.html"
# id: bikeshed

# - name: Build Level 2
# if: steps.filter.outputs.level2 == 'true'
# run: bikeshed spec level2/index.bs "${{ env.build_dir }}/level2/index.html"
# id: bikeshed

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: "${{ env.build_dir }}"
target-folder: "specs"
commit-message: "publish: changes at ${{ steps.bikeshed.outputs.time }}"
branch: gh-pages
tag: "v${{ steps.bikeshed.outputs.time }}"

0 comments on commit 45643be

Please sign in to comment.