update version in doc:installation automatically #136
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
# see https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/ | |
name: Documentation | |
on: | |
release: | |
types: [ created, published ] | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
paths: | |
- 'mkdocs.yml' | |
- 'sootup.examples/**' | |
- 'docs/**' | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: install dependencies | |
run: pip install mike | |
- run: pip install mkdocs-material | |
- run: pip install mkdocs-tooltips | |
- run: pip install git+https://github.com/RedisLabs/mkdocs-include.git | |
- run: pip install git+https://github.com/swissiety/LspLexer4Pygments.git | |
# grab latest release url of the JimpleLSP jar and download it | |
- run: curl -s -L -o ./jimplelsp.jar $(curl -s https://api.github.com/repos/swissiety/jimpleLsp/releases/latest | grep 'browser_download_url".*jar"' | cut -d ':' -f 2,3 | tr -d \") | |
- name: replace version in .md files | |
run: sed -i 's\{{ git_latest_release }}\'$(git tag --sort=committerdate | grep -E '[0-9]' | tail -1 | cut -b 2-7)'\g' *.md | |
- run: git fetch origin gh-pages --depth=1 | |
- name: Configure git user | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: deploy doc in subdirectory (pr) | |
if: github.event_name == 'pull_request' | |
run: mike deploy ${{ github.head_ref }} --push | |
- name: deploy doc in subdirectory (release) | |
if: github.event_name == 'release' | |
run: mike deploy ${{ github.ref }} --push | |
- name: deploy doc and update alias 'latest' to the new doc deployment | |
if: github.event_name == 'release' && github.event.action == 'published' | |
run: mike --push --update-aliases $(echo ${{ github.ref }} | sed -e "s#refs/heads/##g") latest |