Skip to content

Test policy topic added #271

Test policy topic added

Test policy topic added #271

Workflow file for this run

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@v3
with:
fetch-depth: 10
- name: Build
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
# Only build lib playbook if it changed
if [ "$changed_ui" = true ] || [ "$changed_ext" = true ] || [ "$changed_libs" = true ] || [ "$changed_actions" = true ]; then
./libdoc.sh "${{ (startsWith(github.ref, 'refs/heads/develop') && 'develop') || 'master' }}"
echo "built_libs=true" >> $GITHUB_OUTPUT
else
echo "built_libs=false" >> $GITHUB_OUTPUT
fi
# Always build sitedoc because all other changes affect it
./sitedoc.sh ${{ github.ref_name }}
- name: Remove lib dirs
if: steps.build.outputs.built_libs == 'true'
shell: bash
working-directory: build
run: |
find "lib" -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 == 'cppalliance/site-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-pages (revsys cluster)
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'cppalliance/site-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-docs (staging on GKE)
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'cppalliance/site-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 (production on GKE)
if: matrix.publish && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'cppalliance/site-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: Publish Releases as Artifacts
if: matrix.publish && github.event_name == 'push'
uses: actions/upload-artifact@v3
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 }}*.*