Skip to content

docs(RFC): Add RFC for Defaulting IMAP IDLE (Push) On for New Account… #15

docs(RFC): Add RFC for Defaulting IMAP IDLE (Push) On for New Account…

docs(RFC): Add RFC for Defaulting IMAP IDLE (Push) On for New Account… #15

Workflow file for this run

---
name: Build - Docs & Deploy to GitHub Pages
on:
push:
branches:
- main
paths:
- 'docs/**'
workflow_dispatch:
concurrency:
group: "pages"
cancel-in-progress: false
permissions:
contents: read
jobs:
build-docs:
if: ${{ github.repository_owner == 'thunderbird' }}
runs-on: ubuntu-latest
environment: botmobile
steps:
- name: App token generate
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
if: ${{ vars.BOT_CLIENT_ID }}
id: app-token
with:
client-id: ${{ vars.BOT_CLIENT_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
token: ${{ steps.app-token.outputs.token || github.token }}
- name: Cargo cache
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
- name: Install mdbook and extensions
run: ./docs/install.sh
- name: Test docs
run: mdbook test docs
- name: Build docs
run: |
BUILD_DIR=$(mktemp -d)
echo "BUILD_DIR=${BUILD_DIR}" >> $GITHUB_ENV
echo "Building docs into ${BUILD_DIR}"
mdbook build docs --dest-dir="${BUILD_DIR}"
echo "Build output preview:"
ls -la "${BUILD_DIR}" || true
# Clean up unwanted files from the build directory before copying to gh-pages
rm -rf "${BUILD_DIR}/assets/draw.io" || true
rm -f "${BUILD_DIR}/.gitignore" || true
rm -f "${BUILD_DIR}/install.sh" || true
- name: Deploy docs to gh-pages
env:
APP_SLUG: ${{ steps.app-token.outputs.app-slug || 'github-actions'}}
APP_USER_ID: ${{ vars.BOT_USER_ID || '41898282' }}
run: |
git config --global user.name "${APP_SLUG}"
git config --global user.email "${APP_USER_ID}+${APP_SLUG}[bot]@users.noreply.github.com"
# Fetch the gh-pages branch
git fetch origin gh-pages || git checkout --orphan gh-pages
git checkout gh-pages
# Get the short commit hash
COMMIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
# Keep necessary files and clean `docs/latest/`
mkdir -p docs/latest # Ensure the folder exists
find docs/latest -mindepth 1 -delete # Delete old files inside docs/latest
# Copy new docs to gh-pages branch
if [ ! -d "${BUILD_DIR}" ]; then
echo "ERROR: BUILD_DIR '${BUILD_DIR}' does not exist. The docs build may have failed."
exit 1
fi
echo "Copy docs from ${BUILD_DIR} to docs/latest/"
cp -a "${BUILD_DIR}/." docs/latest/ || { echo "ERROR: No files to copy from ${BUILD_DIR}"; exit 1; }
# Remove temporary build directory
rm -rf "${BUILD_DIR}" || true
# Add, commit, and push changes
git add .
git commit -m "Deploy docs update from [${COMMIT_HASH}]" || echo "No changes to commit"
git push --force-with-lease origin gh-pages