Files
Meshtastic-Android/.github/workflows/docs-release.yml
T

99 lines
3.4 KiB
YAML

name: Docs Release
# Publishes release docs to the persistent gh-pages branch: the site root
# (latest release) and a permanent /vX.Y.Z/ copy, plus refreshed Dokka at
# /api/. The /main/ snapshot is owned by docs-deploy.yml and left untouched.
#
# workflow_dispatch exists for backfill: run it against a vX.Y.Z tag ref to
# (re)publish that version without cutting a new tag.
on:
push:
tags:
- 'v*.*.*'
- '!v*-*'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
publish:
if: github.repository == 'meshtastic/Meshtastic-Android'
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
with:
submodules: true
fetch-depth: 0
- name: Extract Version
id: version
run: |
if ! [[ "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "This workflow must run against a vX.Y.Z tag ref (got $GITHUB_REF)." >&2
echo "For workflow_dispatch, select the release tag under 'Use workflow from'." >&2
exit 1
fi
TAG=${GITHUB_REF#refs/tags/v}
echo "version=$TAG" >> $GITHUB_OUTPUT
echo "Deploying docs for version: $TAG"
- name: Gradle Setup
uses: ./.github/actions/gradle-setup
with:
gradle_encryption_key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '4.0.6'
bundler-cache: true
working-directory: docs
# Build root docs site (/ on Pages)
- name: Build Root Docs Site
run: ./gradlew generateDocsBundle publishDocsSite -Pdocs.channel=root -Pci=true
# Build versioned docs (/vX.Y.Z/ on Pages)
- name: Build Versioned Docs
run: ./gradlew generateDocsBundle publishDocsSite -Pdocs.channel=release -Pdocs.version=${{ steps.version.outputs.version }} -Pci=true
# Build Dokka API reference (/api/ on Pages)
- name: Build Dokka HTML documentation
run: ./gradlew dokkaGeneratePublicationHtml --no-configuration-cache
- name: Compile Jekyll Sites
run: |
# Build versioned Jekyll site
BUNDLE_GEMFILE=docs/Gemfile bundle exec jekyll build \
--source build/_site/v${{ steps.version.outputs.version }} \
--destination build/jekyll_release \
--baseurl /${{ github.event.repository.name }}/v${{ steps.version.outputs.version }}
# Move versioned source folder out of root source folder to avoid nested build issues
mv build/_site/v${{ steps.version.outputs.version }} build/v_temp
# Build root Jekyll site
BUNDLE_GEMFILE=docs/Gemfile bundle exec jekyll build \
--source build/_site \
--destination build/jekyll_root \
--baseurl /${{ github.event.repository.name }}
- name: Stage channels
run: |
mkdir -p build/pages_staging
cp -r build/jekyll_root build/pages_staging/root
cp -r build/jekyll_release build/pages_staging/v${{ steps.version.outputs.version }}
cp -r build/dokka/html build/pages_staging/api
- name: Publish to gh-pages
run: scripts/docs/publish-to-gh-pages.sh build/pages_staging root v${{ steps.version.outputs.version }} api