From 2f000a4bca007f354cf78e8fe2e8d44411317d4a Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:00:54 -0400 Subject: [PATCH 01/21] initial action to publish gh-pages --- .github/publish-docs.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/publish-docs.yml diff --git a/.github/publish-docs.yml b/.github/publish-docs.yml new file mode 100644 index 000000000..0df8dcae8 --- /dev/null +++ b/.github/publish-docs.yml @@ -0,0 +1,30 @@ +name: Publish Docs + +on: + push: + branches: [ master, main, 1096-gh-pages ] + paths: + - "docs/**" + - ".github/workflows/publish-docs.yml" + + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: | + make st2 + sudo apt-get update + sudo apt install python3-dev + sudo apt install libldap2-dev + sudo apt install libsasl2-dev + make docs + - name: Deploy to GitHub Pages + uses: crazy-max/ghaction-github-pages@v3 + with: + target_branch: gh-pages + build_dir: docs/build/html + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 5a85d8dfeee71810b860b6530434461da7fcb7a4 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:01:41 -0400 Subject: [PATCH 02/21] put gh actions workflow in the correct place --- .github/{ => workflows}/publish-docs.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/publish-docs.yml (100%) diff --git a/.github/publish-docs.yml b/.github/workflows/publish-docs.yml similarity index 100% rename from .github/publish-docs.yml rename to .github/workflows/publish-docs.yml From 664d580ae4d0ed0df7e7fe1877e2322c0cf60ce3 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:07:14 -0400 Subject: [PATCH 03/21] add virtualenv --- .github/workflows/publish-docs.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 0df8dcae8..39d39961a 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -17,9 +17,11 @@ jobs: run: | make st2 sudo apt-get update - sudo apt install python3-dev + # python3-dev is already available + # sudo apt install python3-dev sudo apt install libldap2-dev sudo apt install libsasl2-dev + sudo apt install python-virtualenv make docs - name: Deploy to GitHub Pages uses: crazy-max/ghaction-github-pages@v3 From dbac6d3a0b8591609e96262f4334bbcdad5f2246 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:09:53 -0400 Subject: [PATCH 04/21] install virtualenv with pip3 --- .github/workflows/publish-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 39d39961a..efd3d1d90 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -21,7 +21,7 @@ jobs: # sudo apt install python3-dev sudo apt install libldap2-dev sudo apt install libsasl2-dev - sudo apt install python-virtualenv + sudo pip3 install virtualenv make docs - name: Deploy to GitHub Pages uses: crazy-max/ghaction-github-pages@v3 From fae56765002d477767bdd19b2f595b7e7d2359ae Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:11:31 -0400 Subject: [PATCH 05/21] debugging --- .github/workflows/publish-docs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index efd3d1d90..7b4d2d5c3 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -15,6 +15,9 @@ jobs: - uses: actions/checkout@v2 - name: Build run: | + echo "which python" + which python + make st2 sudo apt-get update # python3-dev is already available From 2d18a9893f80368e20df187c151b307e406c937c Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:13:36 -0400 Subject: [PATCH 06/21] alias python --- .github/workflows/publish-docs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 7b4d2d5c3..159077c9c 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -17,6 +17,7 @@ jobs: run: | echo "which python" which python + alias python3.6='/usr/bin/python' make st2 sudo apt-get update From cb63d3a84b7cc5db053f846bfd62538a43ffaafe Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:17:16 -0400 Subject: [PATCH 07/21] just specify python instead of python3.6 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 708dda962..49b47a995 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ DOC_BUILD_DIR := docs/build BINARIES := bin -PYTHON_VERSION := python3.6 +PYTHON_VERSION := python # All components are prefixed by st2 COMPONENTS := $(wildcard st2*) From 03f722167097e1fe1621a497642eef3e82b48afe Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:17:41 -0400 Subject: [PATCH 08/21] remove python alias stuff --- .github/workflows/publish-docs.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 159077c9c..efd3d1d90 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -15,10 +15,6 @@ jobs: - uses: actions/checkout@v2 - name: Build run: | - echo "which python" - which python - alias python3.6='/usr/bin/python' - make st2 sudo apt-get update # python3-dev is already available From 0dd95417f4caec5166a148d259262c0e4c9923fa Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:31:26 -0400 Subject: [PATCH 09/21] troubleshooting --- .github/workflows/publish-docs.yml | 2 +- Makefile | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index efd3d1d90..b2f6e3fb6 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -2,7 +2,7 @@ name: Publish Docs on: push: - branches: [ master, main, 1096-gh-pages ] + branches: [ master ] paths: - "docs/**" - ".github/workflows/publish-docs.yml" diff --git a/Makefile b/Makefile index 49b47a995..b27846d6d 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,19 @@ docs: requirements orquesta .docs # RST table $(ST2_VIRTUALENV_DIR)/lib/$(PYTHON_VERSION)/site-packages/pytablewriter: $(ST2_VIRTUALENV_DIR)/done . $(ST2_VIRTUALENV_DIR)/bin/activate; pip install pytablewriter + echo "DEBUGGING======" + echo "$(ST2_VIRTUALENV_DIR)" + ls $(ST2_VIRTUALENV_DIR) + + echo "$(ST2_VIRTUALENV_DIR)/lib" + ls $(ST2_VIRTUALENV_DIR)/lib + + echo "$(ST2_VIRTUALENV_DIR)/lib/$(PYTHON_VERSION)" + ls $(ST2_VIRTUALENV_DIR)/lib/$(PYTHON_VERSION) + + echo "$(ST2_VIRTUALENV_DIR)/lib/$(PYTHON_VERSION)/site-packages" + ls $(ST2_VIRTUALENV_DIR)/lib/$(PYTHON_VERSION)/site-packages + touch $@ .PHONY: .docs From 354e2b79dcfd927bd71c4719e40e655f45abb498 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:35:52 -0400 Subject: [PATCH 10/21] use python3.8 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b27846d6d..8edd0ab36 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ DOC_BUILD_DIR := docs/build BINARIES := bin -PYTHON_VERSION := python +PYTHON_VERSION := python3.8 # All components are prefixed by st2 COMPONENTS := $(wildcard st2*) From 54cfd49b33a3d1baab30281a409d34fb2f81ad49 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 13:36:22 -0400 Subject: [PATCH 11/21] include makefile in trigger --- .github/workflows/publish-docs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index b2f6e3fb6..91d8353c1 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -6,6 +6,7 @@ on: paths: - "docs/**" - ".github/workflows/publish-docs.yml" + - "Makefile" jobs: From de8024e6daafe2f45c560df035885f73e826ee06 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 14:05:18 -0400 Subject: [PATCH 12/21] add nojekyll file --- .nojekyll | 0 Makefile | 13 ------------- 2 files changed, 13 deletions(-) create mode 100644 .nojekyll diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/Makefile b/Makefile index 8edd0ab36..7ca5f2f69 100644 --- a/Makefile +++ b/Makefile @@ -53,19 +53,6 @@ docs: requirements orquesta .docs # RST table $(ST2_VIRTUALENV_DIR)/lib/$(PYTHON_VERSION)/site-packages/pytablewriter: $(ST2_VIRTUALENV_DIR)/done . $(ST2_VIRTUALENV_DIR)/bin/activate; pip install pytablewriter - echo "DEBUGGING======" - echo "$(ST2_VIRTUALENV_DIR)" - ls $(ST2_VIRTUALENV_DIR) - - echo "$(ST2_VIRTUALENV_DIR)/lib" - ls $(ST2_VIRTUALENV_DIR)/lib - - echo "$(ST2_VIRTUALENV_DIR)/lib/$(PYTHON_VERSION)" - ls $(ST2_VIRTUALENV_DIR)/lib/$(PYTHON_VERSION) - - echo "$(ST2_VIRTUALENV_DIR)/lib/$(PYTHON_VERSION)/site-packages" - ls $(ST2_VIRTUALENV_DIR)/lib/$(PYTHON_VERSION)/site-packages - touch $@ .PHONY: .docs From 16150cd60f50837821161a74a70f5e0e90b5e0d6 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Tue, 7 Jun 2022 14:10:35 -0400 Subject: [PATCH 13/21] add nojekyll to build not to root of repo --- .github/workflows/publish-docs.yml | 3 +++ .nojekyll | 0 2 files changed, 3 insertions(+) delete mode 100644 .nojekyll diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 91d8353c1..b2d2a72e4 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -24,6 +24,9 @@ jobs: sudo apt install libsasl2-dev sudo pip3 install virtualenv make docs + + # turn off jekyll so that url routing works properly with underscores + touch docs/build/html/.nojekyll - name: Deploy to GitHub Pages uses: crazy-max/ghaction-github-pages@v3 with: diff --git a/.nojekyll b/.nojekyll deleted file mode 100644 index e69de29bb..000000000 From d2bb36979cf858a13b3bf8f47841e52576a6acf8 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Wed, 15 Jun 2022 12:04:47 -0400 Subject: [PATCH 14/21] remove circleci --- .circleci/config.yml | 75 -------------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 3d012d337..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,75 +0,0 @@ -# Set ST2DOCS_BUCKET variable in CircleCI Environment -version: 2 -jobs: - st2docs: - docker: - - image: circleci/python:3.6 - steps: - - checkout - - run: - name: Clone ST2 - command: | - make st2 - - restore_cache: - key: v2-dependency-cache-{{ checksum "st2/requirements.txt" }} - - run: sudo apt-get update - - run: sudo apt install python3-dev - - run: sudo apt install libldap2-dev - - run: sudo apt install libsasl2-dev - - run: make docs - - run: - name: Store HTML docs in workspace dir - command: mkdir /tmp/st2docs && cp -r docs/build/html/* /tmp/st2docs/ - - persist_to_workspace: - root: /tmp - paths: - - st2docs - - store_artifacts: - path: /tmp/st2docs - destination: st2docs - - save_cache: - key: v2-dependency-cache-{{ checksum "st2/requirements.txt" }} - paths: - - ~/.cache/pip - deploy: - docker: - - image: cibuilds/aws:1.16.43 - steps: - - attach_workspace: - at: ./generated-site - - run: - name: Deploy to docs.stackstorm.com - command: | - if [ "${CIRCLE_BRANCH}" = "master" ]; then - aws s3 sync generated-site/st2docs/ \ - s3://${ST2DOCS_BUCKET}/latest - else - S3_OBJ=$(echo "${CIRCLE_BRANCH}" | sed 's/^v\(.*\)$/\1/') - aws s3 sync generated-site/st2docs/ \ - s3://${ST2DOCS_BUCKET}/${S3_OBJ} - fi - - run: - # Check the install scripts to see if this is the current GA version - name: Check if current GA branch, in which case also deploy to main site - command: | - GA_VER=$(curl -sSL https://stackstorm.com/packages/install.sh|grep ^BRANCH=|sed 's/[^0-9.]*//g') - if [ "${CIRCLE_BRANCH}" = "v${GA_VER}" ]; then - aws s3 sync generated-site/st2docs/ \ - s3://${ST2DOCS_BUCKET}/ - else - echo "Not current GA version" - fi - -workflows: - version: 2 - build-deploy: - jobs: - - st2docs - - deploy: - requires: - - st2docs - filters: - branches: - only: - - master - - /v[0-9]+\.[0-9]+/ From dff9e1fbd91b0e0fb2766e9d6da00f0e908c1b72 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Mon, 20 Jun 2022 14:13:55 -0400 Subject: [PATCH 15/21] re-add circleci --- .circleci/config.yml | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..412109be4 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,74 @@ +# Set ST2DOCS_BUCKET variable in CircleCI Environment +version: 2 +jobs: + st2docs: + docker: + - image: circleci/python:3.6 + steps: + - checkout + - run: + name: Clone ST2 + command: | + make st2 + - restore_cache: + key: v2-dependency-cache-{{ checksum "st2/requirements.txt" }} + - run: sudo apt-get update + - run: sudo apt install python3-dev + - run: sudo apt install libldap2-dev + - run: sudo apt install libsasl2-dev + - run: make docs + - run: + name: Store HTML docs in workspace dir + command: mkdir /tmp/st2docs && cp -r docs/build/html/* /tmp/st2docs/ + - persist_to_workspace: + root: /tmp + paths: + - st2docs + - store_artifacts: + path: /tmp/st2docs + destination: st2docs + - save_cache: + key: v2-dependency-cache-{{ checksum "st2/requirements.txt" }} + paths: + - ~/.cache/pip + deploy: + docker: + - image: cibuilds/aws:1.16.43 + steps: + - attach_workspace: + at: ./generated-site + - run: + name: Deploy to docs.stackstorm.com + command: | + if [ "${CIRCLE_BRANCH}" = "master" ]; then + aws s3 sync generated-site/st2docs/ \ + s3://${ST2DOCS_BUCKET}/latest + else + S3_OBJ=$(echo "${CIRCLE_BRANCH}" | sed 's/^v\(.*\)$/\1/') + aws s3 sync generated-site/st2docs/ \ + s3://${ST2DOCS_BUCKET}/${S3_OBJ} + fi + - run: + # Check the install scripts to see if this is the current GA version + name: Check if current GA branch, in which case also deploy to main site + command: | + GA_VER=$(curl -sSL https://stackstorm.com/packages/install.sh|grep ^BRANCH=|sed 's/[^0-9.]*//g') + if [ "${CIRCLE_BRANCH}" = "v${GA_VER}" ]; then + aws s3 sync generated-site/st2docs/ \ + s3://${ST2DOCS_BUCKET}/ + else + echo "Not current GA version" + fi +workflows: + version: 2 + build-deploy: + jobs: + - st2docs + - deploy: + requires: + - st2docs + filters: + branches: + only: + - master + - /v[0-9]+\.[0-9]+/ \ No newline at end of file From 9b8039dd8114588e63d827e509d65efa16fd5939 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Mon, 20 Jun 2022 14:14:14 -0400 Subject: [PATCH 16/21] read python_version from env var --- .circleci/config.yml | 2 ++ .github/workflows/publish-docs.yml | 2 ++ Makefile | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 412109be4..884f0b603 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,6 +2,8 @@ version: 2 jobs: st2docs: + environment: + python_version: python3.6 docker: - image: circleci/python:3.6 steps: diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index b2d2a72e4..b37b5300a 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -15,6 +15,8 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build + env: + python_version: python3.6 run: | make st2 sudo apt-get update diff --git a/Makefile b/Makefile index 7ca5f2f69..d7cf2eba2 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ DOC_BUILD_DIR := docs/build BINARIES := bin -PYTHON_VERSION := python3.8 +PYTHON_VERSION := ${python_version} # All components are prefixed by st2 COMPONENTS := $(wildcard st2*) From 45cd54a554e53ff98850a5d9e6ebe5c92693988a Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Mon, 20 Jun 2022 14:17:56 -0400 Subject: [PATCH 17/21] fix python version for gha workflow and use peaceiris action for gh pages publish --- .github/workflows/publish-docs.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index b37b5300a..320f52acb 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v2 - name: Build env: - python_version: python3.6 + python_version: python3.8 run: | make st2 sudo apt-get update @@ -30,9 +30,7 @@ jobs: # turn off jekyll so that url routing works properly with underscores touch docs/build/html/.nojekyll - name: Deploy to GitHub Pages - uses: crazy-max/ghaction-github-pages@v3 + uses: peaceiris/actions-gh-pages@v3 with: - target_branch: gh-pages - build_dir: docs/build/html - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/html \ No newline at end of file From 2f85300134200a43ed3def41286cd7a0925ddbb3 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Mon, 20 Jun 2022 14:20:43 -0400 Subject: [PATCH 18/21] default value for PYTHON_VERSION in makefile --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index d7cf2eba2..8d8200846 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,9 @@ BINARIES := bin PYTHON_VERSION := ${python_version} +# set python version if it is not set (i.e. python_version env var not provided) +PYTHON_VERSION ?= python3.6 + # All components are prefixed by st2 COMPONENTS := $(wildcard st2*) COMPONENTS_RUNNERS := $(wildcard st2/contrib/runners/*) From 897b95e32431cbf661b309584558d0b4cd89cbe0 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Mon, 20 Jun 2022 16:42:23 -0400 Subject: [PATCH 19/21] enhanced version handling --- .../publish-docs-concurrency-test.yml | 145 ++++++++++++++++++ .github/workflows/publish-docs.yml | 80 +++++++++- 2 files changed, 223 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish-docs-concurrency-test.yml diff --git a/.github/workflows/publish-docs-concurrency-test.yml b/.github/workflows/publish-docs-concurrency-test.yml new file mode 100644 index 000000000..79b2f0f74 --- /dev/null +++ b/.github/workflows/publish-docs-concurrency-test.yml @@ -0,0 +1,145 @@ +name: Publish Docs + +on: + push: + branches: + - master + + # filter on version branches: + # circleci filtered on version branches like this: + # filters: + # branches: + # only: + # - master + # - /v[0-9]+\.[0-9]+/ + # full regex filtering not supported: https://github.community/t/using-regex-for-filtering/16427 + # subset filtering supported: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + - v[0-9]+.[0-9]+ + paths: + - "docs/**" + - ".github/workflows/publish-docs.yml" + - "Makefile" + + +jobs: + + # publish GA if this is a GA publish + publish-ga: + + # running a gh-pages publish while one is ongoing will result in the previous execution being cancelled in favor of the subsequent one + # use concurrency to ensure these jobs don't overwrite each other + concurrency: + group: gh-pages-build + cancel-in-progress: false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Determine if latest GA version + run: | + export BRANCH_OR_TAG_NAME=${GITHUB_REF##*/} + export IS_LATEST_GA_VERSION="0" + + # GA_VER=$(curl -sSL https://stackstorm.com/packages/install.sh|grep ^BRANCH=|sed 's/[^0-9.]*//g') + GA_VER=9.9 + if [ "${BRANCH_OR_TAG_NAME}" = "v${GA_VER}" ]; then + echo "Current GA Version. Deploy root" + IS_LATEST_GA_VERSION="1" + else + echo "Not current GA version" + fi + + + # debug output + echo "BRANCH_OR_TAG_NAME: $BRANCH_OR_TAG_NAME" + echo "GA_VER: $GA_VER" + echo "IS_LATEST_GA_VERSION: $IS_LATEST_GA_VERSION" + + # set for next github action step + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files + echo "IS_LATEST_GA_VERSION=$IS_LATEST_GA_VERSION" >> $GITHUB_ENV + + - name: Build + if: ${{ env.IS_LATEST_GA_VERSION == '1' }} + env: + python_version: python3.8 + run: | + make st2 + sudo apt-get update + # python3-dev is already available + # sudo apt install python3-dev + sudo apt install libldap2-dev + sudo apt install libsasl2-dev + sudo pip3 install virtualenv + make docs + + # turn off jekyll so that url routing works properly with underscores + touch docs/build/html/.nojekyll + + # since deploying the root in gh pages will wipe away any other versioned subdirectories, + # deploy the latest ga version to a `ga` subdirectory, and use routing to point the root docs.stackstorm.com to `docs.stackstorm.com/ga` + - name: Deploy to Root GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + if: ${{ env.IS_LATEST_GA_VERSION == '1' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/html + destination_dir: "ga" + + + # publish the version or 'latest' subdirectory + publish-version: + concurrency: + group: gh-pages-build + cancel-in-progress: false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: extract version subdirectory + env: + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + run: | + export BRANCH_OR_TAG_NAME=${GITHUB_REF##*/} + + # set up subdirectory path + # `/latest` if default branch + # branch name otherwise + if [ "${BRANCH_OR_TAG_NAME}" == "${DEFAULT_BRANCH}" ]; then + export PUBLISH_SUBDIRECTORY="latest" + else + # remove the preceeding "v" + export PUBLISH_SUBDIRECTORY=$(echo "${BRANCH_OR_TAG_NAME}" | sed 's/^v\(.*\)$/\1/') + fi + + # debug output + echo "DEFAULT_BRANCH: ${DEFAULT_BRANCH}" + echo "BRANCH_OR_TAG_NAME: $BRANCH_OR_TAG_NAME" + echo "PUBLISH_SUBDIRECTORY: $PUBLISH_SUBDIRECTORY" + + # set for next github action step + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files + echo "PUBLISH_SUBDIRECTORY=$PUBLISH_SUBDIRECTORY" >> $GITHUB_ENV + + - name: Build + env: + python_version: python3.8 + run: | + make st2 + sudo apt-get update + # python3-dev is already available + # sudo apt install python3-dev + sudo apt install libldap2-dev + sudo apt install libsasl2-dev + sudo pip3 install virtualenv + make docs + + # turn off jekyll so that url routing works properly with underscores + touch docs/build/html/.nojekyll + + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/html + destination_dir: ${{ env.PUBLISH_SUBDIRECTORY}} \ No newline at end of file diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 320f52acb..6b5f7c757 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -2,7 +2,19 @@ name: Publish Docs on: push: - branches: [ master ] + branches: + - master + + # filter on version branches: + # circleci filtered on version branches like this: + # filters: + # branches: + # only: + # - master + # - /v[0-9]+\.[0-9]+/ + # full regex filtering not supported: https://github.community/t/using-regex-for-filtering/16427 + # subset filtering supported: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet + - v[0-9]+.[0-9]+ paths: - "docs/**" - ".github/workflows/publish-docs.yml" @@ -29,8 +41,72 @@ jobs: # turn off jekyll so that url routing works properly with underscores touch docs/build/html/.nojekyll + + - name: extract subdirectory + env: + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + run: | + export BRANCH_OR_TAG_NAME=${GITHUB_REF##*/} + + # set up subdirectory path + # `/latest` if default branch + # branch name otherwise + if [ "${BRANCH_OR_TAG_NAME}" == "${DEFAULT_BRANCH}" ]; then + export PUBLISH_SUBDIRECTORY="latest" + else + # remove the preceeding "v" + export PUBLISH_SUBDIRECTORY=$(echo "${BRANCH_OR_TAG_NAME}" | sed 's/^v\(.*\)$/\1/') + fi + + # debug output + echo "DEFAULT_BRANCH: ${DEFAULT_BRANCH}" + echo "BRANCH_OR_TAG_NAME: $BRANCH_OR_TAG_NAME" + echo "PUBLISH_SUBDIRECTORY: $PUBLISH_SUBDIRECTORY" + + # set for next github action step + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files + echo "PUBLISH_SUBDIRECTORY=$PUBLISH_SUBDIRECTORY" >> $GITHUB_ENV + + - name: Determine if latest GA version + run: | + export BRANCH_OR_TAG_NAME=${GITHUB_REF##*/} + export IS_LATEST_GA_VERSION="0" + + GA_VER=$(curl -sSL https://stackstorm.com/packages/install.sh|grep ^BRANCH=|sed 's/[^0-9.]*//g') + if [ "${BRANCH_OR_TAG_NAME}" = "v${GA_VER}" ]; then + echo "Current GA Version. Deploy root" + IS_LATEST_GA_VERSION="1" + else + echo "Not current GA version" + fi + + + # debug output + echo "BRANCH_OR_TAG_NAME: $BRANCH_OR_TAG_NAME" + echo "IS_LATEST_GA_VERSION: $IS_LATEST_GA_VERSION" + + # set for next github action step + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files + echo "IS_LATEST_GA_VERSION=$IS_LATEST_GA_VERSION" >> $GITHUB_ENV + + - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/build/html \ No newline at end of file + publish_dir: docs/build/html + destination_dir: ${{ env.PUBLISH_SUBDIRECTORY}} + + + # TODO: running a gh-pages publish while one is ongoing will result in the previous execution being cancelled in favor of the subsequent one + # We cannot use the following step without ensuring it won't cancel other active gh-pages deployments + + # since deploying the root in gh pages will wipe away any other versioned subdirectories, + # deploy the latest ga version to a `ga` subdirectory, and use routing to point the root docs.stackstorm.com to `docs.stackstorm.com/ga` + # - name: Deploy to Root GitHub Pages + # uses: peaceiris/actions-gh-pages@v3 + # if: ${{ env.IS_LATEST_GA_VERSION == '1' }} + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # publish_dir: docs/build/html + # destination_dir: "ga" \ No newline at end of file From b802387574e4e38c79f99834be1367ec91d53791 Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Mon, 20 Jun 2022 16:43:26 -0400 Subject: [PATCH 20/21] figure out variables first --- .github/workflows/publish-docs.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index 6b5f7c757..61bde6c70 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -26,21 +26,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Build - env: - python_version: python3.8 - run: | - make st2 - sudo apt-get update - # python3-dev is already available - # sudo apt install python3-dev - sudo apt install libldap2-dev - sudo apt install libsasl2-dev - sudo pip3 install virtualenv - make docs - - # turn off jekyll so that url routing works properly with underscores - touch docs/build/html/.nojekyll - name: extract subdirectory env: @@ -89,6 +74,21 @@ jobs: # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files echo "IS_LATEST_GA_VERSION=$IS_LATEST_GA_VERSION" >> $GITHUB_ENV + - name: Build + env: + python_version: python3.8 + run: | + make st2 + sudo apt-get update + # python3-dev is already available + # sudo apt install python3-dev + sudo apt install libldap2-dev + sudo apt install libsasl2-dev + sudo pip3 install virtualenv + make docs + + # turn off jekyll so that url routing works properly with underscores + touch docs/build/html/.nojekyll - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 From bee2261c50f35d90d0b20430d0cc3201a790fa8e Mon Sep 17 00:00:00 2001 From: Mick McGrath Date: Mon, 20 Jun 2022 16:47:29 -0400 Subject: [PATCH 21/21] comment out the concurrency test --- .../publish-docs-concurrency-test.yml | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/publish-docs-concurrency-test.yml b/.github/workflows/publish-docs-concurrency-test.yml index 79b2f0f74..9213c8781 100644 --- a/.github/workflows/publish-docs-concurrency-test.yml +++ b/.github/workflows/publish-docs-concurrency-test.yml @@ -1,24 +1,25 @@ name: Publish Docs -on: - push: - branches: - - master - - # filter on version branches: - # circleci filtered on version branches like this: - # filters: - # branches: - # only: - # - master - # - /v[0-9]+\.[0-9]+/ - # full regex filtering not supported: https://github.community/t/using-regex-for-filtering/16427 - # subset filtering supported: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet - - v[0-9]+.[0-9]+ - paths: - - "docs/**" - - ".github/workflows/publish-docs.yml" - - "Makefile" +# TODO: this is commented out unless someone is testing with it +# on: +# push: +# branches: +# - master + +# # filter on version branches: +# # circleci filtered on version branches like this: +# # filters: +# # branches: +# # only: +# # - master +# # - /v[0-9]+\.[0-9]+/ +# # full regex filtering not supported: https://github.community/t/using-regex-for-filtering/16427 +# # subset filtering supported: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet +# - v[0-9]+.[0-9]+ +# paths: +# - "docs/**" +# - ".github/workflows/publish-docs.yml" +# - "Makefile" jobs: