Managing an SR Linux fabric with Ansible #319
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: CICD | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
pull_request: | |
env: | |
MKDOCS_MATERIAL_VER: 9.1.16-insiders-4.36.0-hellt-4 | |
jobs: | |
docs-test: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: docker run -v $(pwd):/docs --entrypoint mkdocs ghcr.io/srl-labs/mkdocs-material-insiders:$MKDOCS_MATERIAL_VER build --clean --strict | |
- name: Cache htmltest external links | |
id: cache-htmltest | |
uses: actions/cache@v2 | |
with: | |
path: tmp/.htmltest | |
# key will contain hash of all md files to check if files have changed | |
# when files are changed, a new key name is formed, and thus a new cache will be saved | |
key: htmltest-${{ hashFiles('docs/**/*.md') }} | |
# the restore key will fetch any previously saved cache even if there is no match on key | |
# this allows to use cache from prev runs and update it | |
restore-keys: | | |
htmltest- | |
- name: htmltest | |
uses: wjdp/htmltest-action@master | |
with: | |
config: docs/htmltest.yml | |
# this action deploys mkdocs-material to gh-pages. It is commented out because we moved to cloudflare pages | |
# publish-docs-gh-pages: | |
# runs-on: ubuntu-20.04 | |
# if: startsWith(github.ref, 'refs/heads/main') | |
# needs: docs-test | |
# steps: | |
# # this is to mitigate unsafe dir errors from git | |
# # https://github.com/actions/checkout/issues/760 | |
# - name: Add workspace as safe directory | |
# run: | | |
# git config --global --add safe.directory /__w/learn-srlinux/learn-srlinux | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 0 | |
# - name: Login to GitHub Container Registry | |
# uses: docker/login-action@v1 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
# - run: docker run -v $(pwd):/docs --entrypoint ash ghcr.io/srl-labs/mkdocs-material-insiders:$MKDOCS_MATERIAL_VER -c 'git config --global --add safe.directory /docs; mkdocs gh-deploy --force' | |
publish-docs: | |
runs-on: ubuntu-20.04 | |
needs: docs-test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build docs-test | |
run: docker run --env CI=true -v $(pwd):/docs --user $(id -u):$(id -g) --entrypoint mkdocs ghcr.io/srl-labs/mkdocs-material-insiders:$MKDOCS_MATERIAL_VER build | |
- name: Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: 62e7f50db0ad5b34dbf1fb9b0ed2ef81 | |
projectName: learn-srlinux | |
directory: site | |
# Optional: Enable this if you want to have GitHub Deployments triggered | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} |