From 38d2c1466e0729b7539793ce7fd0c6885482921a Mon Sep 17 00:00:00 2001 From: Katrina Prosise Date: Fri, 27 Mar 2026 08:18:24 -0400 Subject: [PATCH] Setup publishing workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Workflows set up for `next` to publish to dev, and `main` to publish the versioned docs. `next` will publish when changes are merged, `main` will publish when a tag is created. Other changes made to the configuration file for cleanup and removal of variables that complicated workflow enablement, or served no real purpose. Ran action lint, minor but not breaking issues reported. This commit applies to FFTK-4532, "add dev version" This commit applies to FFTK-4116, "Use GitHub Action…" This commit applies to FFTK-4763, "test workflow…" Signed-off-by: Katrina Prosise --- .github/workflows/publish-dev.yml | 58 ++++++++++++++++ .github/workflows/publish-main.yml | 69 +++++++++++++++++++ source/_static/local-dev-switcher.json | 19 ----- source/_static/switcher.json | 5 ++ source/conf.py | 32 ++------- .../lmp-customization/linux-building.rst | 4 +- 6 files changed, 141 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/publish-dev.yml create mode 100644 .github/workflows/publish-main.yml delete mode 100644 source/_static/local-dev-switcher.json diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml new file mode 100644 index 00000000..dfcbfbdc --- /dev/null +++ b/.github/workflows/publish-dev.yml @@ -0,0 +1,58 @@ +name: publish-dev +on: + push: + branches: + - 'next' + paths: + - 'source/**' + - '.github/workflows/publish-dev.yml' + + workflow_dispatch: + +jobs: + publish-dev: + name: publish docs/dev + runs-on: ubuntu-latest + env: + MEILISEARCH_INDEX_KEY: ${{ secrets.MEILISEARCH_INDEX_KEY }} + MEILISEARCH_SEARCH_KEY: ${{ secrets.MEILISEARCH_SEARCH_KEY }} + MEILISEARCH_HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }} + ADOBE_ANALYTICS_URL: ${{ secrets.ADOBE_ANALYTICS_URL }} + BUCKET_CREDS: ${{ secrets.BUCKET_CREDS }} + + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 + with: + python-version: '3.13' + + - name: install dependencies + run: | + sudo apt update -y + sudo apt-get install -y graphviz fonts-freefont-ttf + pip3 install -U pip + pip3 install -U gsutil==5.27 'pyOpenSSL<24.3.0' + pip3 install --ignore-installed -r requirements.txt + + - name: Add latest Fioctl docs + run: | + export fv=$(wget -q -O- https://api.github.com/repos/foundriesio/fioctl/releases/latest | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/') + wget -O /tmp/fioctl https://github.com/foundriesio/fioctl/releases/download/${fv}/fioctl-linux-amd64 + chmod +x /tmp/fioctl + /tmp/fioctl gen-rst source/appendix/fioctl-command-reference/ + + - name: Build docs + run: | + echo "Building dev docs" + mkdir out + make MP_UPDATE_VERSION="dev" OUTDIR=out SPHINXBUILD=sphinx-build html + + - name: prepare docs for upload and publish docs + run: | + mv out/html out/dev + cd out + tar -czf offline-docs.tgz dev/ + mv offline-docs.tgz dev/ + echo $BUCKET_CREDS > secret + echo -e "secret\nY\nosf-prod\nN\n" | gsutil config -e + gsutil -m rsync -d -r dev gs://docs.foundries.io/dev diff --git a/.github/workflows/publish-main.yml b/.github/workflows/publish-main.yml new file mode 100644 index 00000000..3514dad8 --- /dev/null +++ b/.github/workflows/publish-main.yml @@ -0,0 +1,69 @@ +name: publish-release +on: + push: + tags: + - 'mp-**' + + workflow_dispatch: + +jobs: + publish-stable: + name: publish docs/stable + runs-on: ubuntu-latest + env: + MEILISEARCH_INDEX_KEY: ${{ secrets.MEILISEARCH_INDEX_KEY }} + MEILISEARCH_SEARCH_KEY: ${{ secrets.MEILISEARCH_SEARCH_KEY }} + MEILISEARCH_HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }} + ADOBE_ANALYTICS_URL: ${{ secrets.ADOBE_ANALYTICS_URL }} + BUCKET_CREDS: ${{ secrets.BUCKET_CREDS }} + TAG: ${{ github.ref_name }} + + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 + with: + python-version: '3.13' + + - name: install dependencies + run: | + sudo apt update -y + sudo apt-get install -y graphviz fonts-freefont-ttf + pip3 install -U pip + pip3 install -U gsutil==5.27 'pyOpenSSL<24.3.0' + pip3 install --ignore-installed -r requirements.txt + + - name: Add latest Fioctl docs + run: | + export fv=$(wget -q -O- https://api.github.com/repos/foundriesio/fioctl/releases/latest | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/') + wget -O /tmp/fioctl https://github.com/foundriesio/fioctl/releases/download/${fv}/fioctl-linux-amd64 + chmod +x /tmp/fioctl + /tmp/fioctl gen-rst source/appendix/fioctl-command-reference/ + + - name: set release name + run: | + echo "release tag: $TAG" +# if [[ $TAG == mp-* ]]; then + export RELEASE="$(echo $TAG | sed -r 's/^.{3}//')" +# else +# export RELEASE="$TAG" +# fi + echo "VERSION=$RELEASE" >> "$GITHUB_ENV" + + - name: Build docs + run: | + echo "Building docs $VERSION" + mkdir out + make MP_UPDATE_VERSION="$VERSION" OUTDIR=out SPHINXBUILD=sphinx-build html + + - name: prepare docs for upload and publish docs + run: | + mv out/html out/$VERSION + cd out + tar -czf offline-docs.tgz $VERSION/ + mv offline-docs.tgz $VERSION/ + echo $BUCKET_CREDS > secret + echo -e "secret\nY\nosf-prod\nN\n" | gsutil config -e + gsutil -m rsync -d -r dev gs://docs.foundries.io/$VERSION +# if [[ $TAG == mp-* ]]; then + gsutil -m rsync -d -r gs://docs.foundries.io/${VERSION} gs://docs.foundries.io/latest + fi diff --git a/source/_static/local-dev-switcher.json b/source/_static/local-dev-switcher.json deleted file mode 100644 index 636a0a73..00000000 --- a/source/_static/local-dev-switcher.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { "name": "local-dev", - "version": "dev", - "url": "http://127.0.0.1:8000/" - }, - { - "name": "v95 (stable)", - "version": "95", - "url": "https://docs.foundries.io/latest/", - "preferred": true - }, - { - "name": "…older", - "version": "", - "url": "https://docs.foundries.io/" - } -] - - diff --git a/source/_static/switcher.json b/source/_static/switcher.json index 78a0727d..b68f4604 100644 --- a/source/_static/switcher.json +++ b/source/_static/switcher.json @@ -1,4 +1,9 @@ [ + { + "name": "dev (unstable)", + "version": "dev", + "url": "https://docs.foundries.io/dev" + }, { "name": "v96 (stable)", "version": "96", diff --git a/source/conf.py b/source/conf.py index 2dc27f82..ccb66a79 100644 --- a/source/conf.py +++ b/source/conf.py @@ -50,7 +50,7 @@ # Tags to append to the version, if any. # (This doesn't affect links to artifacts.) mp_tags = '' -if mp_version.startswith('git-'): +if mp_version.startswith('git-') or mp_version == 'dev': if pr == 'False': mp_tags = 'local-dev' else: @@ -66,7 +66,7 @@ search_version = 'default' else: - if mp_tags== 'dev' or mp_tags == 'local-dev': + if mp_tags == 'dev' or mp_tags == 'local-dev': search_version = 'dev' else: @@ -92,7 +92,7 @@ #-- Get version used for link to offline docs page ----------------------------- -if mp_version.startswith('git-'): +if mp_version.startswith('git-') or mp_version == 'dev': gh_release = 'releases' else: gh_release = 'releases/tag/mp-' + mp_version @@ -114,20 +114,11 @@ # Derive the subscriber tags to use for this build from the # corresponding version information. -if mp_version.startswith('git-'): +if mp_version.startswith('git-') or mp_version == 'dev': docker_tag = 'latest' else: docker_tag = mp_version -# Provide Git tags for the same information. (This can produce -# somewhat strange command lines for development builds, like cloning -# a repository and checking out master, but it works for subscriber -# updates.) -if mp_version.startswith('git-'): - git_tag = 'main' -else: - git_tag = 'mp-' + mp_version + mp_tags - # And likewise for repo and west manifests (which have a different tag # namespace than the project tags, that happens to mostly match the # docker tags.) @@ -140,10 +131,6 @@ #parent_dir = dirname(dirname(abspath(__file__))) #sys.path.insert(0, join(parent_dir, 'extensions')) -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# # The short X.Y version. version = mp_version # The full version, including alpha/beta/rc tags. @@ -225,10 +212,9 @@ # Standard epilog to be included in all files. rst_epilog = ''' .. |docker_tag| replace:: {} -.. |git_tag| replace:: {} .. |manifest_tag| replace:: {} .. |fioctl_version| replace:: {} -'''.format(docker_tag, git_tag, manifest_tag, fioctl_version) +'''.format(docker_tag, manifest_tag, fioctl_version) # -- PDF Configuration -------------------------------------------------------- @@ -251,12 +237,8 @@ json_url = 'https://docs.foundries.io/latest/_static/switcher.json' version_match = release if "dev" in release: - version_match = 'dev' - if mp_tags == 'local-dev': - json_url = '_static/local-dev-switcher.json' - if mp_tags == 'dev': - json_url = 'https://raw.githubusercontent.com/foundriesio/docs/refs/main/next/source/_static/switcher.json' - + version_match= 'dev' + json_url = 'https://raw.githubusercontent.com/foundriesio/docs/refs/heads/next/source/_static/switcher.json' # Pydata Theme options html_theme_options = { 'pygments_light_style': 'default', diff --git a/source/user-guide/lmp-customization/linux-building.rst b/source/user-guide/lmp-customization/linux-building.rst index b270d8c4..45b82634 100644 --- a/source/user-guide/lmp-customization/linux-building.rst +++ b/source/user-guide/lmp-customization/linux-building.rst @@ -91,7 +91,7 @@ Setup $ mkdir -p ~/lmp/sstate-cache ~/lmp/downloads ~/lmp/build -#. Run |version| of the container as the ``builder`` user: +#. Run the container as the ``builder`` user: .. parsed-literal:: @@ -117,7 +117,7 @@ The `Google Repo`_ tool fetches Git repos at known-good revisions, and keeps the $ cd build/lmp -#. Fetch release |version| using :term:`Repo`: +#. Fetch release using :term:`Repo`: .. parsed-literal::