Update to w3c/csswg-drafts@9e2a77e2ad4d54abbb8c83bc29ebc43c37cfbc85 #450
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| # Allow one concurrent deployment | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| - run: pip3 install bikeshed jinja2 | |
| - name: Update Bikeshed | |
| run: bikeshed update | |
| - name: Build specs | |
| run: | | |
| set -e | |
| shopt -s globstar extglob | |
| cd csswg-drafts | |
| # Handle markdown | |
| for file in ./**/*.@(md|markdown); do | |
| if [[ "$file" = *.md ]]; then | |
| DEST="${file%.md}/index.html" | |
| else | |
| DEST="${file%.markdown}/index.html" | |
| fi | |
| mkdir -p "$(dirname "$DEST")" | |
| echo '<!DOCTYPE html>' >> "$DEST" | |
| echo '<meta charset="UTF-8">' >> "$DEST" | |
| echo '<meta name="color-scheme" content="light dark">' >> "$DEST" | |
| echo -n '<plaintext style="white-space: pre">' >> "$DEST" | |
| cat "$file" >> "$DEST" | |
| done | |
| # Handle non-bikeshed specs. | |
| for file in ./**/Overview.html; do | |
| cp "$file" "$(dirname "$file")/index.html" | |
| done | |
| # Handle bikeshed specs. | |
| for file in ./**/Overview.bs; do | |
| echo "Building $file" | |
| # We use `date` to build a YYYY-MM-DD date rather than using git's | |
| # `--format=%as` because we want the date not to depend on the | |
| # committer's timezone. We use UTC to avoid depending on the build | |
| # runner's timezone as well. | |
| TIMESTAMP="$(git log -1 --format=%at "$file")" | |
| SHORT_DATE="$(date --date=@"$TIMESTAMP" --utc +%F)" | |
| DIR="$(dirname "$file")" | |
| mkdir -p "bikeshed/$DIR" | |
| bikeshed -f --print=json spec "$file" "$DIR/index.html" --md-date="$SHORT_DATE" | \ | |
| python ../build-output-html.py "$file" "./bikeshed/$DIR/index.html" | |
| done | |
| - name: Build index & symlinks | |
| run: python ./build-index.py | |
| - run: | | |
| mkdir output | |
| cp test-setup/templates/index.html output/index.html | |
| cp -r csswg-drafts output/test | |
| - run: rm -rf ./output/test/.git{,attributes,ignore} | |
| - name: Build redirects to the official mirror | |
| run: | | |
| # For every folder in ./output/test that has an index.html (except for | |
| # ./output/test itself), we build a redirect in ./output | |
| set -e | |
| for index in ./output/test/*/index.html; do | |
| folder_name="$(basename "$(dirname "$index")")" | |
| python ./test-setup/redirect.py "$folder_name" | |
| done | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ github.event_name == 'pull_request' }} | |
| with: | |
| path: ./output | |
| - name: Deploy | |
| uses: peaceiris/actions-gh-pages@v3 | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| exclude_assets: ".github" | |
| publish_dir: ./output |