Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/check-openapi-spec-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand Down
48 changes: 44 additions & 4 deletions .platform/applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<html><head><meta http-equiv="refresh" content="0; url=https://docs.upsun.com/api/"></head>' > "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api/index.html"
echo '<body><p>API documentation has moved to <a href="https://docs.upsun.com/api/">https://docs.upsun.com/api/</a></p></body></html>' >> "${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 "<p>Currently under maintenance. Please check back later.</p>" >> "${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 "<p>Currently under maintenance. Please check back later.</p>" >> "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/index.html"
fi

cd $SITE_DIR
cp ../../themes/psh-docs/postcss.config.js .
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -116,6 +140,18 @@
else
echo "<p>Currently under maintenance. Please check back later.</p>" >> "${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 "<p>Currently under maintenance. Please check back later.</p>" >> "${PLATFORM_APP_DIR}/${SITE_DIR}/public/api-internal/index.html"
fi

cd $SITE_DIR
cp ../../themes/psh-docs/postcss.config.js .
npm install
Expand Down Expand Up @@ -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

Expand Down
Loading