Skip to content

Deploy Docs

Deploy Docs #688

Workflow file for this run

# This is a special and separate job because of sphinx multiversion
# checks out random tips of other branches and the code isn't build just from
# what triggered the event. For any branch that changes we need to always
# build and deploy from master :(
# Triggering a job from multiple branches in parallel is racy, but it's what we have :(
# The scheduled job will eventually fix it.
name: Deploy Docs
on:
push:
branches:
- 'master'
- 'v[0-9]+.[0-9]+'
paths:
- 'docs/**'
- '.github/**'
schedule:
- cron: '0 23 * * *' # daily at 11pm
workflow_dispatch:
env:
retention_days: 90
jobs:
build-and-test:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'master'
persist-credentials: false
fetch-depth: 0
- name: Setup dependencies
uses: ./.github/actions/docs/setup
- name: Build
uses: ./.github/actions/docs/build
with:
build_target: "multiversion"
deploy:
name: Deploy
runs-on: ubuntu-22.04
needs:
- build-and-test
steps:
- uses: actions/download-artifact@v3
with:
name: docs.tar.xz
path: ~/
- name: Deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run : |
set -euExo pipefail
shopt -s inherit_errexit
cd "$( mktemp -d )"
tar -xJf ~/docs.tar.xz ./dirhtml --strip-components=2
# Sanity check
[[ -f index.html ]]
git init
git config --local user.email "action@scylladb.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Publish docs"
git push --force "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" master:gh-pages
failure-notifications:
name: Failure notifications
runs-on: ubuntu-22.04
needs:
- build-and-test
- deploy
if: ${{ failure() }}
steps:
- name: Report failures to Slack
if: ${{ always() }}
working-directory: .
run: |
# We have to avoid printing the secret to logs.
set +x
curl -X POST -H 'Content-type: application/json' --data @<( cat <<-EOF
{
"text": ":warning: CI workflow \"${{ github.workflow }}\" triggered on \"${{ github.event_name }}\" event from ${{ github.ref }} (${{ github.sha }}) failed!\n:fire_extinguisher: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} for details.:fire:\ncc: <@U01L8R3RYFN> <@UN90LVATC>"
}
EOF
) '${{ secrets.SLACK_WEBHOOK_URL }}'