-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (92 loc) · 3.33 KB
/
release-documentation.yml
File metadata and controls
109 lines (92 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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}