/
githubmirror
/
kmod
Обзор
Документация
Войти
/
githubmirror
/
kmod
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
.github/workflows/docs.yml
113 строк
4 KB
Lucas De Marchi
ci: Allow to generate docs for past release
10 авг 2026, 18:44
10 авг 2026, 18:44
44281f3
Код
Авторство
О чём код?
name: Trigger kmod-project.github.io on: # Runs on pushes targeting master and tag with prefix `v` push: branches: - 'master' - 'ci-test-docs' tags: - 'v*' workflow_dispatch: inputs: tag: description: 'Tag to generate docs for' required: true type: string publish: description: 'Publish generated docs to website' default: true type: boolean # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: "pages" cancel-in-progress: false jobs: docs: runs-on: ubuntu-26.04 container: image: 'ubuntu:26.04' steps: - name: Validate trigger env: INPUT_TAG: ${{ inputs.tag }} run: | if [[ -n "${INPUT_TAG}" ]] && [[ ! "$INPUT_TAG" =~ ^v[0-9\.]+$ ]]; then echo "::error::Invalid tag format ${INPUT_TAG}" exit 1 fi - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ inputs.tag }} - name: Setup OS uses: ./.github/actions/setup-os - name: Build docs run: | meson setup --native-file build-dev.ini -Ddocs=true build-docs/ meson compile -C build-docs docs - name: Extract docs version shell: bash env: INPUT_TAG: ${{ inputs.tag }} run: | if [[ -n "${INPUT_TAG}" ]]; then TAG="${INPUT_TAG#refs/tags/}" echo DOC_VERSION="${TAG%%.*}" >> $GITHUB_ENV echo DOC_VERSION_COMMIT="$(git rev-parse HEAD)" >> $GITHUB_ENV elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then TAG="${GITHUB_REF#refs/tags/}" echo DOC_VERSION="${TAG%%.*}" >> $GITHUB_ENV echo DOC_VERSION_COMMIT="${GITHUB_SHA}" >> $GITHUB_ENV elif [[ "${GITHUB_REF}" == refs/heads/* ]]; then echo DOC_VERSION="${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV echo DOC_VERSION_COMMIT="${GITHUB_SHA}" >> $GITHUB_ENV else exit 1 fi - name: Check publish id: check_publish env: PUBLISH: ${{ inputs.publish }} run: | if [[ "$PUBLISH" == "false" ]]; then echo "publish=false" >> $GITHUB_OUTPUT elif [[ "$PUBLISH" == "true" ]]; then echo "publish=true" >> $GITHUB_OUTPUT elif [[ "${GITHUB_REF}" == refs/heads/master || "${GITHUB_REF}" == refs/tags/* ]]; then echo "publish=true" >> $GITHUB_OUTPUT else echo "publish=false" >> $GITHUB_OUTPUT fi - name: Push docs to kmod-project.github.io uses: QXIP/github-action-push-to-another-repository@a910af640bd64288db58f0e71a361aabac022f8b if: steps.check_publish.outputs.publish == 'true' env: API_TOKEN_GITHUB: ${{ secrets.KMOD_DOCS }} with: source-directory: 'build-docs/libkmod/docs/html' destination-github-username: '${{ github.repository_owner }}' destination-repository-name: 'kmod-project.github.io' user-name: 'github-actions[bot]' user-email: '41898282+github-actions[bot]@users.noreply.github.com' target-branch: 'pages' commit-message: 'Auto-add ${{ env.DOC_VERSION }} docs for commit ${{ env.DOC_VERSION_COMMIT }}' target-directory: '${{ env.DOC_VERSION }}' - name: Dispatch kmod-project.github.io uses: peter-evans/repository-dispatch@v4 if: steps.check_publish.outputs.publish == 'true' with: token: ${{ secrets.KMOD_DOCS }} repository: ${{ github.repository_owner }}/kmod-project.github.io event-type: publish-doc client-payload: '{"source":"${{ github.repository }}","version":"${{ env.DOC_VERSION }}"}'