diff --git a/.github/workflows/release-spec-runner.yml b/.github/workflows/release-spec-runner.yml index 538bc8632f..a74ed3d571 100644 --- a/.github/workflows/release-spec-runner.yml +++ b/.github/workflows/release-spec-runner.yml @@ -117,3 +117,19 @@ jobs: spectral_version: ${{ vars.SPECTRAL_VERSION }} foascli_version: ${{ vars.FOASCLI_VERSION }} atlas_prod_base_url: ${{ vars.ATLAS_PROD_BASE_URL }} + + release-spec-v1-prod: + name: Release OpenAPI Spec V1 (Deprecated) for PROD + if: >- + github.event_name == 'schedule' || contains(inputs.env_to_release, 'prod') + uses: ./.github/workflows/release-spec-v1.yml + secrets: + api_bot_pat: ${{ secrets.API_BOT_PAT }} + aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }} + aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }} + mms_deployed_sha_url: ${{ secrets.MMS_DEPLOYED_SHA_URL_PROD }} + with: + aws_default_region: ${{ vars.AWS_DEFAULT_REGION}} + aws_s3_bucket: ${{ vars.S3_BUCKET_PROD}} + env: prod + branch: main diff --git a/.github/workflows/release-spec-v1.yml b/.github/workflows/release-spec-v1.yml new file mode 100644 index 0000000000..bb60887d85 --- /dev/null +++ b/.github/workflows/release-spec-v1.yml @@ -0,0 +1,85 @@ +name: 'Release OpenAPI Spec V1 for a given environment' +on: + workflow_call: + inputs: + aws_default_region: + description: 'AWS Default Region.' + required: true + type: string + aws_s3_bucket: + description: 'AWS S3 Bucket.' + required: true + type: string + env: + description: 'Environment to generate the OpenAPI Spec for.' + required: true + type: string + branch: + description: 'Branch to release the OpenAPI Spec to.' + required: true + type: string + secrets: # all secrets are passed explicitly in this workflow + api_bot_pat: + required: true + aws_access_key_id: + required: true + aws_secret_access_key: + required: true + mms_deployed_sha_url: + required: true + +permissions: + contents: write + issues: write + +jobs: + release-v1-oas-apis: + name: Release OpenAPI Spec for V1 (DEPRECATED) APIs + runs-on: ubuntu-latest + steps: + - name: Download v1 Spec + env: + AWS_DEFAULT_REGION: ${{inputs.aws_default_region}} + AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }} + S3_BUCKET: ${{ inputs.aws_s3_bucket }} + MMS_DEPLOYED_SHA_URL: ${{secrets.mms_deployed_sha_url}} + run: | + sha=$(curl "${MMS_DEPLOYED_SHA_URL}") + echo "Downloading the OpenAPI Spec for v1 with sha ${sha}" + aws s3 cp "s3://${S3_BUCKET}/openapi/oas/mms-v1/${sha}.json" "v1.json" + - name: Generate YAML spec + run: | + sudo snap install yq + yq -P '.' v1.json > v1.yaml + - name: Upload artifact + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 + with: + name: openapi-v1-${{ inputs.env }} + path: | + v1.json + v1.yaml + - name: Checkout repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + ref: ${{ inputs.branch }} + token: ${{secrets.api_bot_pat}} + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: openapi-v1-${{ inputs.env }} + github-token: ${{ secrets.api_bot_pat }} + run-id: ${{ github.run_id }} + path: openapi/v1-deprecated + - name: Commit changes + id: commit + uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 + env: + target_env: ${{ inputs.env }} + target_branch: ${{ inputs.branch }} + run_id: ${{ github.run_id }} + with: + commit_message: "(${{env.target_env}}) Release OpenAPI Spec V1 :rocket:. See https://github.com/mongodb/openapi/actions/runs/${{env.run_id}}." + commit_author: "github-actions[bot] " + branch: ${{env.target_branch}} + file_pattern: "openapi/v1-deprecated/*" diff --git a/.github/workflows/release-spec.yml b/.github/workflows/release-spec.yml index 46fd47d75a..f5d7fcb98d 100644 --- a/.github/workflows/release-spec.yml +++ b/.github/workflows/release-spec.yml @@ -85,7 +85,7 @@ jobs: spectral_version: ${{ vars.SPECTRAL_VERSION }} release: - name: Release OpenAPI Spec + name: Release OpenAPI Spec for V2 APIs runs-on: ubuntu-latest needs: [run-required-validations] outputs: @@ -152,7 +152,7 @@ jobs: commit_author: "github-actions[bot] " branch: ${{env.target_branch}} file_pattern: "openapi/*" - + release-postman: name: Release Postman needs: [release] diff --git a/openapi/v1-deprecated/branded-preview.html b/openapi/v1-deprecated/branded-preview.html new file mode 100644 index 0000000000..ba8d1aabf1 --- /dev/null +++ b/openapi/v1-deprecated/branded-preview.html @@ -0,0 +1,9 @@ + + + +

Preview docs for:

+ + +