Skip to content

build: set up build workflow #8

build: set up build workflow

build: set up build workflow #8

Workflow file for this run

##
# 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 }}"