Chore: write up and publish tutorials for other OpenStack providers #3133
This file contains hidden or 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: Automatic docs update pipeline | |
| on: | |
| issue_comment: | |
| types: [created, edited] | |
| # Run when PR is labeled | |
| pull_request: | |
| types: [labeled] | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| pull-requests: write | |
| # Allow one concurrent deployment | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-publish: | |
| name: Automatically update docs | |
| if: ${{ (github.event.issue.pull_request && contains(github.event.comment.body, '/refresh-docs')) || github.event.label.name == 'refresh-docs' }} | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up git author | |
| run: | | |
| git config --global user.name "${GITHUB_ACTOR}" | |
| git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # NOTE: the pipeline will fail, if gh-pages branch isn't created!!! | |
| - name: Git fetch gh-pages | |
| run: git fetch origin gh-pages | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.13 | |
| - name: Install Python dependencies | |
| run: pip install -r requirements.txt | |
| - name: Retrieve latest version tag | |
| run: | | |
| LATEST_VERSION=$(mike list | grep [latest] | awk '{sub(/\[latest\]/, ""); print}') | |
| echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV | |
| # this is only possible, when there is already a version with latest alias | |
| # in case there isn't a version like this you have to | |
| # 1. mike deploy <version> latest | |
| # 2. mike set-default latest | |
| # 3. mike deploy <version_from_cmd_1> latest --push | |
| # --push flag in the latest cmd is necessary, when you want to apply changes in gh-pages branch and also in GH Pages | |
| - name: Deploy new docs version | |
| run: mike deploy ${LATEST_VERSION} latest --update-aliases --push | |
| # The llms files need to be located in the root path of a website | |
| - name: Copy llms files to root of gh-pages | |
| run: | | |
| set -e | |
| git checkout gh-pages | |
| cp latest/{llms-full.txt,llms.txt} . | |
| git add llms-full.txt llms.txt | |
| if git commit -m "Add llms files to root"; then | |
| echo "Committed llms files to root" | |
| git push origin gh-pages | |
| else | |
| echo "No changes to commit for llms files" | |
| fi | |
| git checkout - |