Fix markdown formatter configuration #688
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docs Site | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
# default types and closed | |
types: [opened, synchronize, reopened, closed] | |
jobs: | |
# https://github.com/nosborn/github-action-markdown-cli | |
markdownlint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 1 | |
steps: | |
- name: Checkout workspace | |
uses: actions/checkout@v4 | |
- name: Run linter | |
uses: nosborn/[email protected] | |
with: | |
config_file: .markdownlint.json | |
files: . | |
dot: true | |
# https://github.com/gaurav-nelson/github-action-markdown-link-check | |
markdown-link-check: | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
steps: | |
- name: Checkout workspace | |
uses: actions/checkout@v4 | |
- name: Run linter | |
uses: gaurav-nelson/github-action-markdown-link-check@v1 | |
with: | |
config-file: .markdown-link-check.json | |
folder-path: . | |
markdown-link-redirection-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Check links to external sites redirect to a new tab | |
uses: ./.github/actions/docs-lint/ | |
env: | |
ROOT: './docs/' | |
# https://squidfunk.github.io/mkdocs-material/publishing-your-site/#with-github-actions | |
docs-update: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
# very hacky I know but I can't think of a better way right now | |
- name: Wait for docs to deploy | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
shell: bash | |
run: sleep 120 | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
# checkout all commits to get accurate page revision times | |
# for the git-revision-date-localized plugin | |
# and to fetch the gh-pages branch | |
fetch-depth: '0' | |
- name: Start containers | |
shell: bash | |
run: docker compose -f .devcontainer/docker-compose.yml -f .devcontainer/docs/docker-compose.docs.yml up -d | |
- name: Build docs | |
if: github.event_name == 'push' || github.event.action != 'closed' | |
shell: bash | |
run: docker compose -f .devcontainer/docker-compose.yml exec -T docs /bin/sh -c "mkdocs build" | |
- name: "Delete pr-${{ github.event.number }} version of the Docs" | |
if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
shell: bash | |
run: | | |
docker compose -f .devcontainer/docker-compose.yml exec -T docs /bin/sh -c "\ | |
git config user.name ci-bot && \ | |
git config user.email [email protected] && \ | |
mike delete --push pr-${{ github.event.number }}" | |
- name: "Deploy pr-${{ github.event.number }} version of the Docs" | |
if: github.event_name == 'pull_request' && github.event.action != 'closed' | |
shell: bash | |
run: | | |
docker compose -f .devcontainer/docker-compose.yml exec -T docs /bin/sh -c "\ | |
git config user.name ci-bot && \ | |
git config user.email [email protected] && \ | |
git switch gh-pages && \ | |
git switch - --detach && \ | |
mike deploy pr-${{ github.event.number }} && \ | |
git switch gh-pages && \ | |
git pull --no-rebase && \ | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/UBCSailbot/sailbot_workspace.git && \ | |
git push" | |
- name: Deploy main version of the Docs | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
shell: bash | |
run: | | |
docker compose -f .devcontainer/docker-compose.yml exec -T docs /bin/sh -c "\ | |
git config user.name ci-bot && \ | |
git config user.email [email protected] && \ | |
git switch gh-pages && \ | |
git switch - && \ | |
mike deploy --update-aliases main latest && \ | |
git switch gh-pages && \ | |
git pull --no-rebase && \ | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/UBCSailbot/sailbot_workspace.git && \ | |
git push" |