chore: separate boostlook.css processing to preserve critical styles #638
Workflow file for this run
This file contains 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
# | |
# Copyright (c) 2024 The C++ Alliance, Inc. (https://cppalliance.org) | |
# | |
# Distributed under the Boost Software License, Version 1.0. (See accompanying | |
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
# | |
# Official repository: https://github.com/boostorg/website-v2-docs | |
# | |
name: Build, Test and Upload Antora Docs | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
- develop | |
concurrency: | |
group: ${{format('publish-{0}:{1}', github.repository, github.ref)}} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- { name: 'Ubuntu', os: ubuntu-22.04, publish: true } | |
- { name: 'Windows', os: windows-2022 } | |
name: Publish Antora Docs (${{ matrix.name }}) | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 10 | |
- name: Environment | |
id: build | |
shell: bash | |
run: | | |
# Involved IDs | |
before_id="${{ (github.event_name == 'pull_request' && github.event.pull_request.base.sha) || github.event.before }}" | |
after_id="${{ (github.event_name == 'pull_request' && github.event.pull_request.head.sha) || github.event.after }}" | |
# Sanitize before ID | |
if ! git cat-file -e "$before_id" >/dev/null 2>&1; then | |
echo "before_id is invalid" | |
before_id=$(git rev-parse HEAD^) | |
echo "before_id is now $before_id" | |
fi | |
if git cat-file -e "$before_id" >/dev/null 2>&1; then | |
# Before ID is valid, compare files | |
changed_files=$(git diff --name-only "$before_id" "$after_id" | tr '\n' ' ') | |
changed_ui=$(echo "$changed_files" | grep -q "antora-ui/" && echo true || echo false) | |
changed_ext=$(echo "$changed_files" | grep -q "extensions/" && echo true || echo false) | |
changed_actions=$(echo "$changed_files" | grep -q ".github/" && echo true || echo false) | |
changed_libs=$(echo "$changed_files" | grep -q "libs.playbook.yml" && echo true || echo false) | |
else | |
# Assume anything might have changed | |
changed_ui=true | |
changed_ext=true | |
changed_actions=true | |
changed_libs=true | |
fi | |
set -x | |
# Only build lib playbook if it changed | |
if [ "$changed_ui" = true ] || [ "$changed_ext" = true ] || [ "$changed_libs" = true ] || [ "$changed_actions" = true ]; then | |
echo "build-libs=true" >> $GITHUB_OUTPUT | |
else | |
echo "build-libs=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Build sitedocs | |
shell: bash | |
run: | | |
set -x | |
BOOSTLOOK_BRANCH="${{ (startsWith(github.ref, 'refs/heads/develop') && 'develop') || 'master' }}" | |
export BOOSTLOOK_BRANCH | |
./build.sh | |
- name: Setup Ninja | |
uses: seanmiddleditch/gha-setup-ninja@v4 | |
if: ${{ runner.os == 'Windows' && steps.build.outputs.build-libs == 'true' }} | |
- name: Build Libs | |
if: steps.build.outputs.build-libs == 'true' | |
shell: bash | |
run: | | |
set -x | |
./libdoc.sh "${{ (startsWith(github.ref, 'refs/heads/develop') && 'develop') || 'master' }}" | |
- name: Remove Libs from build | |
if: steps.build.outputs.build-libs == 'true' | |
shell: bash | |
working-directory: build | |
run: | | |
set -x | |
find "lib" -mindepth 1 -maxdepth 1 -type d -exec rm -r {} + | |
# find "cpp-reference-extension" -mindepth 1 -maxdepth 1 -type d -exec rm -r {} + | |
- name: AWS Sync site-docs (revsys cluster) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.REVSYS_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.REVSYS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.REVSYS_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: build/ | |
DEST_DIR: ${{ format('site-docs/{0}', github.ref_name) }} | |
- name: AWS Sync site-docs (production on GKE) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.BOOST_PRODUCTION_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.BOOST_PRODUCTION_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.BOOST_PRODUCTION_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: build/ | |
DEST_DIR: ${{ format('site-docs/{0}', github.ref_name) }} | |
- name: AWS Sync site-docs (staging on GKE) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.BOOST_STAGE_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.BOOST_STAGE_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.BOOST_STAGE_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: build/ | |
DEST_DIR: ${{ format('site-docs/{0}', github.ref_name) }} | |
- name: AWS Sync site-docs (cppal_dev on GKE) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.CPPAL_DEV_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.CPPAL_DEV_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CPPAL_DEV_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: build/ | |
DEST_DIR: ${{ format('site-docs/{0}', github.ref_name) }} | |
- name: AWS Sync site-pages (revsys cluster) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.REVSYS_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.REVSYS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.REVSYS_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: site-pages/ | |
DEST_DIR: ${{ format('site-pages/{0}', github.ref_name) }} | |
- name: AWS Sync site-pages (production on GKE) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.BOOST_PRODUCTION_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.BOOST_PRODUCTION_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.BOOST_PRODUCTION_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: site-pages/ | |
DEST_DIR: ${{ format('site-pages/{0}', github.ref_name) }} | |
- name: AWS Sync site-pages (staging on GKE) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.BOOST_STAGE_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.BOOST_STAGE_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.BOOST_STAGE_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: site-pages/ | |
DEST_DIR: ${{ format('site-pages/{0}', github.ref_name) }} | |
- name: AWS Sync site-pages (cppal_dev on GKE) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.CPPAL_DEV_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.CPPAL_DEV_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CPPAL_DEV_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: site-pages/ | |
DEST_DIR: ${{ format('site-pages/{0}', github.ref_name) }} | |
- name: AWS Sync release-notes (production on GKE) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.BOOST_PRODUCTION_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.BOOST_PRODUCTION_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.BOOST_PRODUCTION_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: release-notes/ | |
DEST_DIR: ${{ format('release-notes/{0}', github.ref_name) }} | |
- name: AWS Sync release-notes (staging on GKE) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.BOOST_STAGE_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.BOOST_STAGE_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.BOOST_STAGE_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: release-notes/ | |
DEST_DIR: ${{ format('release-notes/{0}', github.ref_name) }} | |
- name: AWS Sync release-notes (cppal_dev on GKE) | |
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'boostorg/website-v2-docs' | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --follow-symlinks --delete --exclude '.git/*' --exclude 'build/lib/*' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.CPPAL_DEV_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.CPPAL_DEV_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CPPAL_DEV_ACCESS_KEY }} | |
AWS_REGION: 'us-east-2' | |
SOURCE_DIR: release-notes/ | |
DEST_DIR: ${{ format('release-notes/{0}', github.ref_name) }} | |
- name: Publish Releases as Artifacts | |
if: matrix.publish && github.event_name == 'push' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: site-docs | |
path: build | |
- uses: softprops/action-gh-release@v1 | |
if: matrix.publish && startsWith(github.ref, 'refs/tags/boost-') | |
with: | |
files: | | |
build/${{ github.ref_name }}*.* |