Skip to content
Merged
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
16 changes: 16 additions & 0 deletions .github/workflows/release-spec-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
85 changes: 85 additions & 0 deletions .github/workflows/release-spec-v1.yml
Original file line number Diff line number Diff line change
@@ -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] <github-actions[bot]@users.noreply.github.com>"
branch: ${{env.target_branch}}
file_pattern: "openapi/v1-deprecated/*"
4 changes: 2 additions & 2 deletions .github/workflows/release-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
branch: ${{env.target_branch}}
file_pattern: "openapi/*"

release-postman:
name: Release Postman
needs: [release]
Expand Down
9 changes: 9 additions & 0 deletions openapi/v1-deprecated/branded-preview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<body>
<h2>Preview docs for:</h2>
<ul>
<li><a href='https://www.mongodb.com/docs/openapi/preview/?src=https://raw.githubusercontent.com/mongodb/openapi/main/openapi/v1-deprecated/v1.json' target="_blank">v1.json</a></li><li><a href='https://www.mongodb.com/docs/openapi/preview/?src=https://raw.githubusercontent.com/mongodb/openapi/main/openapi/v1-deprecated/v1.yaml' target="_blank">v1.yaml</a></li>
</ul>
</body>
</html>
Loading