Skip to content

Commit 8ef4280

Browse files
fixes
1 parent 146ab47 commit 8ef4280

File tree

4 files changed

+110
-2
lines changed

4 files changed

+110
-2
lines changed

.github/scripts/branded_preview.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ done < <(jq -r '.[]' versions.json)
1919
all_urls=(
2020
"https://raw.githubusercontent.com/mongodb/openapi/${branch_name:?}/openapi/v2.json"
2121
"https://raw.githubusercontent.com/mongodb/openapi/${branch_name:?}/openapi/v2.yaml"
22-
"https://raw.githubusercontent.com/mongodb/openapi/${branch_name:?}/openapi/v1-deprecated/v1.json"
23-
"https://raw.githubusercontent.com/mongodb/openapi/${branch_name:?}/openapi/v1-deprecated/v1.yaml"
2422
)
2523

2624
# Fetch and append file URLs from each version

.github/workflows/release-spec-runner.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,19 @@ jobs:
121121
spectral_version: ${{ vars.SPECTRAL_VERSION }}
122122
foascli_version: ${{ vars.FOASCLI_VERSION }}
123123
atlas_prod_base_url: ${{ vars.ATLAS_PROD_BASE_URL }}
124+
125+
release-spec-v1-prod:
126+
name: Release OpenAPI Spec V1 (Deprecated) for PROD
127+
if: >-
128+
github.event_name == 'schedule' || contains(inputs.env_to_release, 'prod')
129+
uses: ./.github/workflows/release-spec-v1.yml
130+
secrets:
131+
api_bot_pat: ${{ secrets.API_BOT_PAT }}
132+
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
133+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
134+
mms_deployed_sha_url: ${{ secrets.MMS_DEPLOYED_SHA_URL_PROD }}
135+
with:
136+
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
137+
aws_s3_bucket: ${{ vars.S3_BUCKET_PROD}}
138+
env: prod
139+
branch: main
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: 'Release OpenAPI Spec V1 for a given environment'
2+
on:
3+
workflow_call:
4+
inputs:
5+
aws_default_region:
6+
description: 'AWS Default Region.'
7+
required: true
8+
type: string
9+
aws_s3_bucket:
10+
description: 'AWS S3 Bucket.'
11+
required: true
12+
type: string
13+
env:
14+
description: 'Environment to generate the OpenAPI Spec for.'
15+
required: true
16+
type: string
17+
branch:
18+
description: 'Branch to release the OpenAPI Spec to.'
19+
required: true
20+
type: string
21+
secrets: # all secrets are passed explicitly in this workflow
22+
api_bot_pat:
23+
required: true
24+
aws_access_key_id:
25+
required: true
26+
aws_secret_access_key:
27+
required: true
28+
mms_deployed_sha_url:
29+
required: true
30+
31+
permissions:
32+
contents: write
33+
issues: write
34+
35+
jobs:
36+
release-v1-oas-apis:
37+
name: Release OpenAPI Spec for V1 (DEPRECATED) APIs
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Download v1 Spec
41+
env:
42+
AWS_DEFAULT_REGION: ${{inputs.aws_default_region}}
43+
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
44+
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
45+
S3_BUCKET: ${{ inputs.aws_s3_bucket }}
46+
MMS_DEPLOYED_SHA_URL: ${{secrets.mms_deployed_sha_url}}
47+
run: |
48+
sha=$(curl "${MMS_DEPLOYED_SHA_URL}")
49+
echo "Downloading the OpenAPI Spec for v1 with sha ${sha}"
50+
aws s3 cp "s3://${S3_BUCKET}/openapi/oas/mms-v1/${sha}.json" "v1.json"
51+
- name: Generate YAML spec
52+
run: |
53+
sudo apt install yq
54+
yq -P '.' v1.json > v1.yaml
55+
- name: Upload artifact
56+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
57+
with:
58+
name: openapi-v1-${{ inputs.env }}
59+
path: |
60+
v1.json
61+
v1.yaml
62+
- name: Checkout repository
63+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
64+
with:
65+
ref: ${{ inputs.branch }}
66+
token: ${{secrets.api_bot_pat}}
67+
- name: Download artifact
68+
uses: actions/download-artifact@v4
69+
with:
70+
name: openapi-v1-${{ inputs.env }}
71+
github-token: ${{ secrets.api_bot_pat }}
72+
run-id: ${{ github.run_id }}
73+
path: openapi/v1-deprecated
74+
- name: Commit changes
75+
id: commit
76+
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842
77+
env:
78+
target_env: ${{ inputs.env }}
79+
target_branch: ${{ inputs.branch }}
80+
run_id: ${{ github.run_id }}
81+
with:
82+
commit_message: "(${{env.target_env}}) Release OpenAPI Spec V1 :rocket:. See https://github.com/mongodb/openapi/actions/runs/${{env.run_id}}."
83+
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
84+
branch: ${{env.target_branch}}
85+
file_pattern: "openapi/v1-deprecated/*"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<body>
4+
<h2>Preview docs for:</h2>
5+
<ul>
6+
<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">v2.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">v2.yaml</a></li>
7+
</ul>
8+
</body>
9+
</html>

0 commit comments

Comments
 (0)