Skip to content

Publish Docs

Publish Docs #60

Workflow file for this run

name: Publish Docs
on:
pull_request:
branches:
- main
push:
branches:
- "main"
paths-ignore:
- "docs/**"
schedule:
- cron: '0 4 * * 1'
workflow_dispatch:
jobs:
build_and_publish:
name: Build and Publish
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
############
# Build steps
############
- name: "Git config"
run: |
git config --global user.email "tools@ukhsa.gov.uk"
git config --global user.name "Github Action"
- name: "Build and move output"
run: |
make build
mv ./docs ../
- name: "Checkout to gh-pages and clean untracked files"
run: |
git checkout -f gh-pages
git clean -fd
- name: "Current content (./docs)"
run: ls -lartR ./docs/
- name: "Newly denerated ./docs content (../docs)"
run: ls -lartR ../docs/
- name: "Overwrite content"
run : |
rm -Rf ./docs/
mv ../docs ./
- name: "Add version and CNAME file"
run: |
echo "${GITHUB_SHA}" > ./docs/version.txt
touch ./docs/.gitkeep
git status
- name: "Git status"
run: |
git add ./docs
git status
- name: "Git commit"
run: |
git commit --allow-empty -m "Published at $(date)"
- name: "Push"
if: github.ref == 'refs/heads/main'
run: |
git push origin gh-pages --force