|
| 1 | +name: release-documentation |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + tag: |
| 7 | + description: Git tag to deploy |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + |
| 11 | +# Мы хотим чтобы deploy в ветку gh-pages |
| 12 | +# происходили консистентно друг за другом |
| 13 | +concurrency: |
| 14 | + group: deploy-docs |
| 15 | + cancel-in-progress: false |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: write |
| 19 | + |
| 20 | +jobs: |
| 21 | + deploy: |
| 22 | + name: Deploy release documentation |
| 23 | + runs-on: ubuntu-22.04 |
| 24 | + defaults: |
| 25 | + run: |
| 26 | + working-directory: documentation |
| 27 | + steps: |
| 28 | + - name: Validate semver tag format |
| 29 | + id: validate-tag |
| 30 | + run: | |
| 31 | + TAG="${{ github.event.inputs.tag }}" |
| 32 | +
|
| 33 | + if [[ ! $TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 34 | + echo "❌Tag '$TAG' doesn't match semver format" |
| 35 | + echo "Examples: 1.2.3, 3.0.1" |
| 36 | + exit 1 |
| 37 | + fi |
| 38 | + |
| 39 | + MAJOR_MINOR=$(echo $TAG | cut -d. -f1-2) |
| 40 | + VERSION="${MAJOR_MINOR}.*" |
| 41 | + echo "✅ Valid tag: $TAG" |
| 42 | + echo "Version for docs: $VERSION" |
| 43 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 44 | + - name: Checkout repository with tag |
| 45 | + uses: actions/checkout@v6 |
| 46 | + with: |
| 47 | + ref: "${{ github.event.inputs.tag }}" |
| 48 | + fetch-depth: 0 |
| 49 | + |
| 50 | + - name: Configure Git user |
| 51 | + run: | |
| 52 | + git config user.email "actions@github.com" |
| 53 | + git config user.name "GitHub Actions" |
| 54 | +
|
| 55 | + - name: Setup python |
| 56 | + uses: actions/setup-python@v5 |
| 57 | + with: |
| 58 | + python-version: 3.x |
| 59 | + cache: 'pip' |
| 60 | + |
| 61 | + - name: Install dependencies |
| 62 | + run: pip install -r requirements.txt |
| 63 | + |
| 64 | + - name: Deploy documentation |
| 65 | + run: | |
| 66 | + mike deploy "${{ steps.validate-tag.outputs.version }}" --update-aliases --push |
| 67 | +# env: |
| 68 | +# # Для дебага, если нужно |
| 69 | +# MIKE_VERBOSE: 1 |
0 commit comments