restructure workflows
Some checks failed
Release - Build and publish docs / release (push) Failing after 26s

This commit is contained in:
Tony
2026-01-19 12:57:46 -06:00
parent 6faab5aa19
commit cc90896be8
5 changed files with 362 additions and 15 deletions

View File

@@ -1,29 +1,82 @@
name: Build and publish CMBA rulebooks (Gitea)
name: Release - Build and publish docs
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build-release:
release:
if: ${{ !contains(github.ref_name, '-rc.') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/setup-python@v6
- name: Checkout (tag)
uses: actions/checkout@v4
with:
python-version: '3.13'
- name: Install Dependencies
run: pip install -r mkdocs/requirements.txt
- name: Build Docs
fetch-depth: 0
- name: Ensure tag commit is on main
run: |
mkdir $RUNNER_TEMP/dist
mkdocs build -f mkdocs/mkdocs.yml -d $RUNNER_TEMP/${{ github.ref_name }}
zip -r $RUNNER_TEMP/dist/${{ github.ref_name }}.zip $RUNNER_TEMP/${{ github.ref_name }}
- name: Release
if: ${{ !env.ACT }}
set -euo pipefail
git fetch origin main:refs/remotes/origin/main
if ! git merge-base --is-ancestor "${GITHUB_SHA}" "origin/main"; then
echo "ERROR: Tagged commit ${GITHUB_SHA} is not on main. Refusing release."
exit 1
fi
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"
cache-dependency-path: mkdocs/requirements.txt
- name: Install dependencies
run: |
set -euo pipefail
pip install -r mkdocs/requirements.txt
- name: CI gate (MKDOCS_STRICT)
run: |
set -euo pipefail
MKDOCS_STRICT="${MKDOCS_STRICT:-true}"
STRICT_FLAG=""
if [ "${MKDOCS_STRICT}" = "true" ]; then
STRICT_FLAG="--strict"
fi
OFFLINE=true mkdocs build ${STRICT_FLAG} -f mkdocs/mkdocs.yml
- name: Build artifact (non-strict)
env:
MKDOCS_STRICT: "false"
run: |
set -euo pipefail
MKDOCS_STRICT="${MKDOCS_STRICT:-true}"
STRICT_FLAG=""
if [ "${MKDOCS_STRICT}" = "true" ]; then
STRICT_FLAG="--strict"
fi
mkdir -p "${RUNNER_TEMP}/dist"
OFFLINE=true mkdocs build ${STRICT_FLAG} -f mkdocs/mkdocs.yml -d "${RUNNER_TEMP}/dist/${{ github.ref_name }}"
- name: Zip artifact
run: |
set -euo pipefail
cd "${RUNNER_TEMP}/dist"
zip -r "${{ github.ref_name }}.zip" "./${{ github.ref_name }}"
- name: Publish release (skip on act; allowed on gitea)
if: ${{ env.ENABLE_RELEASE == 'true' && env.ACT != 'true' }}
uses: softprops/action-gh-release@v2
with:
files: |
$RUNNER_TEMP/dist/*.zip
${{ runner.temp }}/dist/${{ github.ref_name }}.zip