Skip to content

docs: preview in PRs #172

docs: preview in PRs

docs: preview in PRs #172

Workflow file for this run

# *******************************************************************************
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
name: Documentation
on:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- main
merge_group:
types: [checks_requested]
jobs:
docs-build:
name: Build documentation
# Build the documentation and upload it as an artifact
# TBD: maybe it's easier to separate `closed` into a separate workflow?
if: ${{ (github.event_name != 'pull_request' || github.event.action != 'closed') }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Setup Bazel
uses: bazel-contrib/[email protected]
- name: Build documentation
run: |
bazel build //docs:github-pages && cp bazel-bin/docs/github-pages.tar .
- name: Upload artifact for job analysis
if: github.event_name == 'pull_request'
uses: actions/[email protected]
with:
name: github-pages-${{ github.sha }}
path: github-pages.tar
retention-days: 1
if-no-files-found: error
docs-deploy:
name: Deploy documentation to GitHub Pages
permissions:
pages: write
id-token: write
contents: write
concurrency:
group: gh-pages
cancel-in-progress: false
runs-on: ubuntu-latest
needs: docs-build
steps:
- name: Download documentation artifact
uses: actions/[email protected]
with:
name: github-pages-${{ github.sha }}
- name: Untar documentation artifact
run: tar -xf github-pages.tar
# FIXME: query repository settings instead of blindly trying!
- name: Deploy 🚀
id: pages-deployment
continue-on-error: true
uses: ./.github/actions/deploy-versioned-pages
with:
source_folder: "."
- name: Deploy (fallback) 🚀
id: deployment
# If the new deployment from gh-pages branch fails, at least deploy the current version.
# This is only a short-term solution, until we can change the repository settings.
if: ${{ steps.pages-deployment.outcome == 'failure' && github.event_name == 'push' && github.ref_name == 'main' }}
uses: actions/[email protected]