diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml new file mode 100644 index 00000000..996c1bf0 --- /dev/null +++ b/.github/workflows/publish-dev.yml @@ -0,0 +1,57 @@ +name: publish-dev +on: + push: + branches: + - 'next' + paths: + - 'source/**' + + 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 }} + + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 + with: + python-version: '3.13' + + - name: install dependencies + run: | + 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/') + get -O /tmp/fioctl https://github.com/foundriesio/fioctl/releases/download/${fv}/fioctl-linux-amd64 + chmod +x /tmp/fioctl + /tmp/fioctl gen-rst docs/source/appendix/fioctl-command-reference/ + + - name: Build docs + run: | + mkdir out + make -C docs MP_UPDATE_VERSION="dev" OUTDIR='pwd'/out SPHINXBUILD=sphinx-build html + + - name: prepare docs for upload + run: | + mv out/html out/dev + cd out + tar -czf offline-docs.tgz dev/ + mv offline-docs.tgz dev/ + + - name: publish docs + run: | + gsutil config -e ${{ secrets.BUCKET_CREDS }} + gsutil -m rsync -d -r dev gs://docs.foundries.io/dev diff --git a/source/conf.py b/source/conf.py index 2dc27f82..d49a1244 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.) @@ -225,10 +216,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 -------------------------------------------------------- @@ -255,8 +245,7 @@ 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' - + 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',