Skip to content

Commit

Permalink
fix: SDK reference docs workflow (#2060)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeSchwert authored Aug 5, 2024
1 parent 841249d commit 88a7d78
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/check-docs-deployed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi

# this command will send a GET request to the docs site, the -s option silences the output,
# the -o option redirects the output to /dev/null, and the -w option formats the output to only return the HTTP status code
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://docs.immutable.com/sdk-references/ts-immutable-sdk/$VERSION/modules/_imtbl_sdk.html)
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://docs.immutable.com/sdk-references/ts-immutable-sdk/$VERSION/)

if [ "$HTTP_STATUS" -ne 200 ]; then
echo "SDK reference docs for v$VERSION are not deployed. Check Netlify for the build status. https://app.netlify.com/sites/imx-docs-prod/deploys"
Expand Down
6 changes: 0 additions & 6 deletions .github/scripts/check-docs-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,3 @@ if [ -d "$CLONE_DIR/api-docs/sdk-references/ts-immutable-sdk/$VERSION" ]; then
echo "There is already a docs folder for v$VERSION. Please create a separate PR to update the SDK reference docs for v$VERSION."
exit 1
fi

# check the version contains `alpha` string
if echo "$VERSION" | grep -q "alpha"; then
echo "Skipping docs generation for alpha version"
exit 1
fi
25 changes: 25 additions & 0 deletions .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,34 @@ on:
- completed

jobs:
AlphaCheck:
name: Check if SDK version is alpha
runs-on: ubuntu-latest
outputs:
is_alpha: ${{ steps.alpha_check.outputs.is_alpha }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check alpha version
id: alpha_check
run: |
if $(git describe --tags --abbrev=0) | grep -q "alpha"; then
echo "Skipping docs generation for alpha version"
echo "is_alpha=true" >> $GITHUB_ENV
exit 0
else
echo "is_alpha=false" >> $GITHUB_ENV
fi
shell: bash

PublishDocs:
name: Publish SDK Reference Docs
runs-on: ubuntu-latest
needs: AlphaCheck
if: ${{ needs.AlphaCheck.outputs.is_alpha != 'true' }}
env:
SDK_PUBLISH_SLACK_WEBHOOK: ${{ secrets.SDK_PUBLISH_SLACK_WEBHOOK }}
NETLIFY_BUILD_HOOK: ${{ secrets.NETLIFY_BUILD_HOOK }}
Expand Down

0 comments on commit 88a7d78

Please sign in to comment.