Pluto 1146 how to access enterprise (#2291) #10225
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: MkDocs | |
on: push | |
# Set concurrency group to either "dev" or "prod" | |
concurrency: ${{ fromJSON('{"false":"dev","true":"prod"}')[github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/v')] }} | |
jobs: | |
mkdocs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }} | |
submodules: true | |
# git-revision-date-localized-plugin and mkdocs-rss-plugin need full git history depth | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Obtain pull request number | |
id: pull_request | |
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/release/v') | |
uses: jwalton/gh-find-current-pr@v1 | |
- name: Set up environment variables | |
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/release/v') | |
run: | | |
echo "MKDOCS_PREVIEW_BRANCH=$GITHUB_REF_NAME" >> $GITHUB_ENV | |
echo "MKDOCS_PREVIEW_PULL_REQUEST=${{ steps.pull_request.outputs.pr }}" >> $GITHUB_ENV | |
- name: Build docs | |
run: | | |
mkdocs -v build | |
- name: Upload meta descriptions artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: meta-descriptions | |
path: ./site/meta-descriptions.csv | |
- name: Validate generated HTML files | |
run: | | |
docker run -v $(pwd):/test --rm wjdp/htmltest --conf .htmltest.yml | |
# Deploy branch previews | |
- name: Obtain Netlify alias from branch name | |
id: branch | |
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/release/v') | |
uses: common-fate/[email protected] | |
with: | |
max-length: 35 | |
- name: Deploy docs (branch preview) | |
if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/heads/release/v') | |
uses: nwtgck/[email protected] | |
with: | |
publish-dir: ./site | |
production-branch: master | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: Deploy for branch ${{ github.ref_name }} | |
enable-pull-request-comment: false | |
enable-commit-comment: false | |
enable-commit-status: false | |
overwrites-pull-request-comment: false | |
alias: ${{ steps.branch.outputs.name }} | |
github-deployment-environment: Netlify | |
github-deployment-description: Branch deployment preview | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_PERSONAL_ACCESS_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
# Deploy Latest docs on push to master | |
- name: Set up environment variables | |
if: github.ref == 'refs/heads/master' | |
run: | | |
echo "MKDOCS_VERSION=$(mkdocs --version | cut -d " " -f 3)" >> $GITHUB_ENV | |
echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-9`" >> $GITHUB_ENV | |
echo "CUSTOM_DOMAIN=docs.codacy.com" >> $GITHUB_ENV | |
- name: Create robots.txt | |
if: github.ref == 'refs/heads/master' | |
run: | | |
echo -e "User-agent: *\nSitemap: https://${{ env.CUSTOM_DOMAIN }}/sitemap.xml" > "./site/robots.txt" | |
- name: Deploy docs (Latest) | |
uses: peaceiris/actions-gh-pages@v4 | |
if: github.ref == 'refs/heads/master' | |
with: | |
personal_token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }} | |
publish_dir: ./site | |
destination_dir: ./ | |
keep_files: true | |
cname: ${{ env.CUSTOM_DOMAIN }} | |
allow_empty_commit: true | |
full_commit_message: Deployed ${{ env.SHORT_SHA }} to . with MkDocs ${{ env.MKDOCS_VERSION }} | |
# Deploy Self-hosted docs on push to release/vM.m branch | |
- name: Set up git author | |
uses: oleksiyrudenko/gha-git-credentials@v2 | |
if: startsWith(github.ref, 'refs/heads/release/v') | |
with: | |
name: ${{ github.actor }} | |
email: ${{ github.actor }}@users.noreply.github.com | |
token: ${{ secrets.DEPLOYMENT_PERSONAL_ACCESS_TOKEN }} | |
- name: Deploy docs (Self-hosted) | |
if: startsWith(github.ref, 'refs/heads/release/v') | |
run: | | |
git fetch origin gh-pages --verbose | |
mike deploy ${GITHUB_REF##*/release/} -t "Self-hosted ${GITHUB_REF##*/release/}" --config-file "${GITHUB_WORKSPACE}/mkdocs.yml" --push | |
env: | |
MKDOCS_SELF_HOSTED: true |