Skip to content

sphinx-build-docs

sphinx-build-docs #80

# Distributed under the OSI-approved BSD 3-Clause License.
# See accompanying file LICENSE-BSD for details.
name: ci-deploy-pages
on:
# Triggers the workflow when the 'sphinx-build-docs' workflow is completed.
repository_dispatch:
types:
- sphinx-build-docs
# Triggers the workflow manually through the GitHub UI.
workflow_dispatch:
inputs:
BUILD_RUN_ID:
description: 'BUILD_RUN_ID input'
required: true
type: string
default: 'none'
DEPLOY_ONLY:
description: 'DEPLOY_ONLY input'
required: true
type: choice
default: 'true'
options:
- 'true'
- 'false'
jobs:
precondition:
if: ${{ ( github.repository == 'localizethedocs/python-docs-l10n' ) &&
( ( github.event_name == 'repository_dispatch' &&
github.event.action == 'sphinx-build-docs' ) ) ||
( github.event_name == 'workflow_dispatch' ) }}
runs-on: ${{ vars.RUNNER }}
steps:
- name: Print Contexts/Inputs/Variables/Secrets
shell: bash
run: |
echo "[Contexts]"
echo "github.job = ${{ github.job }}"
echo "github.ref = ${{ github.ref }}"
echo "github.ref_name = ${{ github.ref_name }}"
echo "github.event_name = ${{ github.event_name }}"
echo "github.event.action = ${{ github.event.action }}"
echo "github.event.client_payload.BUILD_RUN_ID = ${{ github.event.client_payload.BUILD_RUN_ID }}"
echo "github.event.client_payload.DEPLOY_ONLY = ${{ github.event.client_payload.DEPLOY_ONLY }}"
echo "[Inputs]"
echo "inputs.BUILD_RUN_ID = ${{ inputs.BUILD_RUN_ID }}"
echo "inputs.DEPLOY_ONLY = ${{ inputs.DEPLOY_ONLY }}"
echo "[Variables]"
echo "vars.RUNNER = ${{ vars.RUNNER }}"
echo "vars.ACTOR_NAME = ${{ vars.ACTOR_NAME }}"
echo "vars.ACTOR_EMAIL = ${{ vars.ACTOR_EMAIL }}"
echo "vars.GPG_FINGERPRINT = ${{ vars.GPG_FINGERPRINT }}"
echo "[Secrets]"
echo "secrets.ACTOR_GITHUB_TOKEN = ${{ secrets.ACTOR_GITHUB_TOKEN }}"
echo "secrets.GPG_PRIVATE_KEY = ${{ secrets.GPG_PRIVATE_KEY }}"
echo "secrets.GPG_PASSPHRASE = ${{ secrets.GPG_PASSPHRASE }}"
- name: Check Required Variables
shell: bash
run: |
REQUIRED_VARIABLES_EXIST=true
if [[ -z "${{ vars.RUNNER }}" ]]; then
echo "vars.RUNNER is missing."
REQUIRED_VARIABLES_EXIST=false
fi
if [[ -z "${{ vars.ACTOR_NAME }}" ]]; then
echo "vars.ACTOR_NAME is missing."
REQUIRED_VARIABLES_EXIST=false
fi
if [[ -z "${{ vars.ACTOR_EMAIL }}" ]]; then
echo "vars.ACTOR_EMAIL is missing."
REQUIRED_VARIABLES_EXIST=false
fi
if [[ -z "${{ vars.GPG_FINGERPRINT }}" ]]; then
echo "vars.GPG_FINGERPRINT is missing."
REQUIRED_VARIABLES_EXIST=false
fi
if [[ "${REQUIRED_VARIABLES_EXIST}" == "false" ]]; then
echo "Error: Some variables are missing." >&2
exit 1
fi
- name: Check Required Secrets
shell: bash
run: |
REQUIRED_SECRETS_EXIST=true
if [[ -z "${{ secrets.ACTOR_GITHUB_TOKEN }}" ]]; then
echo "secrets.ACTOR_GITHUB_TOKEN is missing."
REQUIRED_SECRETS_EXIST=false
fi
if [[ -z "${{ secrets.GPG_PRIVATE_KEY }}" ]]; then
echo "secrets.GPG_PRIVATE_KEY is missing."
REQUIRED_SECRETS_EXIST=false
fi
if [[ -z "${{ secrets.GPG_PASSPHRASE }}" ]]; then
echo "secrets.GPG_PASSPHRASE is missing."
REQUIRED_SECRETS_EXIST=false
fi
if [[ "${REQUIRED_SECRETS_EXIST}" == "false" ]]; then
echo "Error: Some secrets are missing." >&2
exit 1
fi
caller:
needs: [ 'precondition' ]
if: ${{ ( github.repository == 'localizethedocs/python-docs-l10n' ) &&
( ( github.event_name == 'repository_dispatch' &&
github.event.action == 'sphinx-build-docs' ) ) ||
( github.event_name == 'workflow_dispatch' ) }}
permissions:
id-token: write
pages: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.client_payload.BUILD_RUN_ID || inputs.BUILD_RUN_ID }}
cancel-in-progress: true
uses: localizethedocs/ci-common/.github/workflows/use-deploy-pages.yml@main
with:
ENABLE: true
RUNNER: ${{ vars.RUNNER }}
CHECKOUT: ${{ github.ref }}
BUILD_RUN_ID: ${{ github.event.client_payload.BUILD_RUN_ID || inputs.BUILD_RUN_ID }}
DEPLOY_ONLY: ${{ github.event.client_payload.DEPLOY_ONLY || inputs.DEPLOY_ONLY }}
DEPLOY_BRANCH: 'pages'
ACTOR_NAME: ${{ vars.ACTOR_NAME }}
ACTOR_EMAIL: ${{ vars.ACTOR_EMAIL }}
GPG_FINGERPRINT: ${{ vars.GPG_FINGERPRINT }}
secrets:
ACTOR_GITHUB_TOKEN: ${{ secrets.ACTOR_GITHUB_TOKEN }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}