diff --git a/.github/workflows/check-openapi-spec-update.yaml b/.github/workflows/check-openapi-spec-update.yaml index 3955bd888e..9f6985b0ca 100644 --- a/.github/workflows/check-openapi-spec-update.yaml +++ b/.github/workflows/check-openapi-spec-update.yaml @@ -23,7 +23,7 @@ jobs: git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - - name: Download redoc_static.html from GitLab + - name: Download redoc_static.html and redoc-static-internal.html from GitLab env: GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} run: | @@ -48,6 +48,18 @@ jobs: --output shared/pages/openapispec-upsun.yaml \ "https://lab.plat.farm/api/v4/projects/${PROJECT_ENCODED}/repository/files/$(python3 -c "import urllib.parse; print(urllib.parse.quote('web/openapispec-upsun.yaml',safe=''))")/raw?ref=${REF}" + # @todo should we also copy over the stylesheet? or should the version in docs be canonical? + curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ + --output shared/pages/api-internal.html \ + "https://lab.plat.farm/api/v4/projects/${PROJECT_ENCODED}/repository/files/$(python3 -c "import urllib.parse; print(urllib.parse.quote('web/redoc-static-internal.html',safe=''))")/raw?ref=${REF}" + # @todo let's refactor this to be more concise. maybe just retrieve everything in the directory? + curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ + --output shared/pages/openapispec-upsun-internal.json \ + "https://lab.plat.farm/api/v4/projects/${PROJECT_ENCODED}/repository/files/$(python3 -c "import urllib.parse; print(urllib.parse.quote('web/openapispec-upsun-internal.json',safe=''))")/raw?ref=${REF}" + # @todo see above + curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \ + --output shared/pages/openapispec-upsun-internal.yaml \ + "https://lab.plat.farm/api/v4/projects/${PROJECT_ENCODED}/repository/files/$(python3 -c "import urllib.parse; print(urllib.parse.quote('web/openapispec-upsun-internal.yaml',safe=''))")/raw?ref=${REF}" - name: Create Pull Request if changes uses: peter-evans/create-pull-request@v6 diff --git a/.platform/applications.yaml b/.platform/applications.yaml index 62a69575c1..2ef346270d 100644 --- a/.platform/applications.yaml +++ b/.platform/applications.yaml @@ -24,10 +24,27 @@ # Build hooks can modify the application files on disk but not access any services like databases. build: | set -e - mkdir -p "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/" - # add yet another fall back redirect in case all the others fail - echo '' > "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/index.html" - echo '

API documentation has moved to https://docs.upsun.com/api/

' >> "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/index.html" + # Public API Docs + mkdir -p "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/styles" + if [ -f "${PLATFORM_APP_DIR}/shared/pages/api.html" ]; then + # @todo refactor so we're not copying over the old platform.sh api docs as well or just remove them + cp -a "${PLATFORM_APP_DIR}/shared/pages/." "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/" + mv "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/api.html" "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/index.html" + cp "${PLATFORM_APP_DIR}/shared/pages/api-style.css" "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/styles/style.css" + else + echo "

Currently under maintenance. Please check back later.

" >> "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/index.html" + fi + + # Internal API Docs + mkdir -p "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/styles" + if [ -f "${PLATFORM_APP_DIR}/shared/pages/api-internal.html" ]; then + # @todo refactor so we're not copying over the old platform.sh api docs as well or just remove them + cp -a "${PLATFORM_APP_DIR}/shared/pages/." "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/" + mv "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/api-internal.html" "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/index.html" + cp "${PLATFORM_APP_DIR}/shared/pages/api-style.css" "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/styles/style.css" + else + echo "

Currently under maintenance. Please check back later.

" >> "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/index.html" + fi cd $SITE_DIR cp ../../themes/psh-docs/postcss.config.js . @@ -71,6 +88,11 @@ root: 'sites/platform/public/api' index: [ 'index.html' ] expires: 24h + '/api-internal': + root: 'sites/platform/public/api-internal' + index: [ 'index.html' ] + expires: 24h + disk: 1024 mounts: @@ -107,6 +129,8 @@ build: | #copy API docs into correct location # @todo once api docs are fully moved we can alter the template.hbs file so style.css can be in /api + + # Public API Docs mkdir -p "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/styles" if [ -f "${PLATFORM_APP_DIR}/shared/pages/api.html" ]; then # @todo refactor so we're not copying over the old platform.sh api docs as well or just remove them @@ -116,6 +140,18 @@ else echo "

Currently under maintenance. Please check back later.

" >> "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/index.html" fi + + # Internal API Docs + mkdir -p "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/styles" + if [ -f "${PLATFORM_APP_DIR}/shared/pages/api-internal.html" ]; then + # @todo refactor so we're not copying over the old platform.sh api docs as well or just remove them + cp -a "${PLATFORM_APP_DIR}/shared/pages/." "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/" + mv "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/api-internal.html" "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/index.html" + cp "${PLATFORM_APP_DIR}/shared/pages/api-style.css" "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/styles/style.css" + else + echo "

Currently under maintenance. Please check back later.

" >> "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/index.html" + fi + cd $SITE_DIR cp ../../themes/psh-docs/postcss.config.js . npm install @@ -161,6 +197,10 @@ root: 'sites/upsun/public/api' index: [ 'index.html' ] expires: 24h + '/api-internal': + root: 'sites/upsun/public/api-internal' + index: [ 'index.html' ] + expires: 24h disk: 1024