release-documentation #9
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: release-documentation | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: Git tag to deploy | |
| required: true | |
| type: string | |
| env: | |
| CI_DOCKER_CACHE_PATH: ci/cache/docker | |
| # Мы хотим чтобы deploy в ветку gh-pages | |
| # происходили консистентно друг за другом | |
| concurrency: | |
| group: deploy-docs | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| name: Deploy release documentation | |
| runs-on: ubuntu-22.04 | |
| env: | |
| RENDERER_NETWORK: renderer-net | |
| RENDERER_IMAGE: plantuml/plantuml-server:jetty-v1.2026.0 | |
| RENDERER_CONTAINER_NAME: renderer | |
| steps: | |
| - name: Validate semver tag format | |
| id: validate-tag | |
| run: | | |
| TAG="${{ github.event.inputs.tag }}" | |
| if [[ ! $TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "❌Tag '$TAG' doesn't match semver format" | |
| echo "Examples: 1.2.3, 3.0.1" | |
| exit 1 | |
| fi | |
| MAJOR_MINOR=$(echo $TAG | cut -d. -f1-2) | |
| VERSION="${MAJOR_MINOR}.*" | |
| echo "✅ Valid tag: $TAG" | |
| echo "Version for docs: $VERSION" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Checkout repository with tag | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: "${{ github.event.inputs.tag }}" | |
| fetch-depth: 0 | |
| - name: Setup docker image cache | |
| id: docker-image-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.CI_DOCKER_CACHE_PATH }} | |
| key: ${{ env.RENDERER_IMAGE }} | |
| - name: Update docker image cache | |
| if: steps.docker-image-cache.outputs.cache-hit != 'true' | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| docker pull "$RENDERER_IMAGE" | |
| mkdir -p ${CI_DOCKER_CACHE_PATH}/${RENDERER_IMAGE} | |
| docker image save -o ${CI_DOCKER_CACHE_PATH}/${RENDERER_CONTAINER_NAME}.tar "$RENDERER_IMAGE" | |
| - name: Load docker image cache | |
| if: steps.docker-image-cache.outputs.cache-hit == 'true' | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| docker image load -i ${CI_DOCKER_CACHE_PATH}/${RENDERER_CONTAINER_NAME}.tar | |
| - name: Start renderer service locally | |
| run: | | |
| docker network create "$RENDERER_NETWORK" | |
| docker run -d -p 7036:8080 --name "$RENDERER_CONTAINER_NAME" --network "$RENDERER_NETWORK" ${RENDERER_REGISTRY}${RENDERER_IMAGE} | |
| - name: Configure Git user | |
| run: | | |
| git config user.email "actions@github.com" | |
| git config user.name "GitHub Actions" | |
| - name: Setup python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| cache: 'pip' | |
| - name: Install dependencies | |
| working-directory: documentation | |
| run: pip install -r requirements.txt | |
| - name: Deploy documentation | |
| working-directory: documentation | |
| run: | | |
| mike deploy "${{ steps.validate-tag.outputs.version }}" --update-aliases --push | |
| # env: | |
| # # Для дебага, если нужно | |
| # MIKE_VERBOSE: 1 | |
| - name: Cleanup renderer container | |
| if: always() | |
| run: | | |
| docker rm -f "$RENDERER_CONTAINER_NAME" | |
| docker network rm -f "$RENDERER_NETWORK" | |
| docker rmi -f ${RENDERER_REGISTRY}${RENDERER_IMAGE} |