From cd9025f85437391d0f7a33409dc1f4df080344cc Mon Sep 17 00:00:00 2001 From: Andrew Meyer Date: Mon, 31 Jul 2023 17:12:00 +0200 Subject: [PATCH] Temporaily add jsdoc publish to restore legacy docs --- .github/workflows/jsdoc-publish.yml | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/jsdoc-publish.yml diff --git a/.github/workflows/jsdoc-publish.yml b/.github/workflows/jsdoc-publish.yml new file mode 100644 index 0000000000..a1f2f65ed7 --- /dev/null +++ b/.github/workflows/jsdoc-publish.yml @@ -0,0 +1,52 @@ +# This workflow builds the JSDocs and publishes them to https://docs.mongodb.com/realm-sdks/js/latest/. +# It also uploads them to a versioned directory for archival purposes. +# +# We only run this workflow for "vX.Y.Z" tags, not "vX.Y.Z-beta", as the docs are pushed to the +# site as "latest" as part of the build and we don't want to publish beta docs to live + +name: JSDoc Publish +on: + push: + tags: + - v[0-9]+\.[0-9]+\.[0-9]+ + workflow_dispatch: + +env: + REALM_DISABLE_ANALYTICS: 1 +jobs: + jsdoc: + name: JSDoc + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: "recursive" + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + - name: Install npm v7 + run: npm install -g npm@8 + # Install the root package (--ignore-scripts to avoid downloading or building the native module) + - name: Install root package dependencies + run: npm ci --ignore-scripts + - name: Run JSDoc documentation build + run: npm run jsdoc + - name: Set up S3cmd and configure AWS credentials + uses: s3-actions/s3cmd@v1.1 + with: + provider: aws + region: "us-west-1" + access_key: ${{ secrets.DOCS_S3_ACCESS_KEY }} + secret_key: ${{ secrets.DOCS_S3_SECRET_KEY }} + # Get the version number so we can specify the correct input path for uploading the docs - + # JSDoc outputs to docs/output/realm/ + - name: get-npm-version + id: package-version + uses: martinbeentjes/npm-get-version-action@master + # --no-mime-magic --guess-mime-type flags to work around CSS incorrect MIME type issue + # (https://stackoverflow.com/questions/53708938/s3cmd-flagging-css-with-wrong-mime-type) + - name: Upload versioned docs (for archival) + run: s3cmd put --recursive --acl-public --no-mime-magic --guess-mime-type docs/output/realm/${{ steps.package-version.outputs.current-version}}/ s3://${{ secrets.DOCS_S3_BUCKET_NAME }}/docs/realm-sdks/js/${{ steps.package-version.outputs.current-version}}/ + - name: Upload latest docs (to live site) + run: s3cmd put --recursive --acl-public --no-mime-magic --guess-mime-type docs/output/realm/${{ steps.package-version.outputs.current-version}}/ s3://${{ secrets.DOCS_S3_BUCKET_NAME }}/docs/realm-sdks/js/latest/