Skip to content

Commit 146ab47

Browse files
CLOUDP-285462: update release process to release v1 spec
1 parent 6ed9999 commit 146ab47

File tree

3 files changed

+61
-2
lines changed

3 files changed

+61
-2
lines changed

.github/scripts/branded_preview.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ 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"
2224
)
2325

2426
# Fetch and append file URLs from each version

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
5454
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
5555
jira_api_token: ${{ secrets.JIRA_API_TOKEN }}
56+
mms_deployed_sha_url: ${{ secrets.MMS_DEPLOYED_SHA_URL_DEV }}
5657
with:
5758
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
5859
aws_s3_bucket: ${{ vars.S3_BUCKET_DEV}}
@@ -71,6 +72,7 @@ jobs:
7172
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_QA }}
7273
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_QA }}
7374
jira_api_token: ${{ secrets.JIRA_API_TOKEN }}
75+
mms_deployed_sha_url: ${{ secrets.MMS_DEPLOYED_SHA_URL_QA }}
7476
with:
7577
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
7678
aws_s3_bucket: ${{ vars.S3_BUCKET_QA}}
@@ -89,6 +91,7 @@ jobs:
8991
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
9092
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
9193
jira_api_token: ${{ secrets.JIRA_API_TOKEN }}
94+
mms_deployed_sha_url: ${{ secrets.MMS_DEPLOYED_SHA_URL_STAGING }}
9295
with:
9396
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
9497
aws_s3_bucket: ${{ vars.S3_BUCKET_STAGING}}
@@ -109,6 +112,7 @@ jobs:
109112
postman_api_key: ${{ secrets.POSTMAN_API_KEY }}
110113
workspace_id: ${{ secrets.WORKSPACE_ID }}
111114
jira_api_token: ${{ secrets.JIRA_API_TOKEN }}
115+
mms_deployed_sha_url: ${{ secrets.MMS_DEPLOYED_SHA_URL_PROD }}
112116
with:
113117
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
114118
aws_s3_bucket: ${{ vars.S3_BUCKET_PROD}}

.github/workflows/release-spec.yml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ on:
4343
required: false
4444
jira_api_token:
4545
required: true
46+
mms_deployed_sha_url:
47+
required: true
4648

4749
permissions:
4850
contents: write
@@ -85,7 +87,7 @@ jobs:
8587
spectral_version: ${{ vars.SPECTRAL_VERSION }}
8688

8789
release:
88-
name: Release OpenAPI Spec
90+
name: Release OpenAPI Spec for V2 APIs
8991
runs-on: ubuntu-latest
9092
needs: [run-required-validations]
9193
outputs:
@@ -152,7 +154,58 @@ jobs:
152154
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
153155
branch: ${{env.target_branch}}
154156
file_pattern: "openapi/*"
155-
157+
158+
release-v1-oas-apis:
159+
name: Release OpenAPI Spec for V1 (DEPRECATED) APIs
160+
runs-on: ubuntu-latest
161+
steps:
162+
- name: Download v1 Spec
163+
env:
164+
AWS_DEFAULT_REGION: ${{inputs.aws_default_region}}
165+
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }}
166+
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }}
167+
S3_BUCKET: ${{ inputs.aws_s3_bucket }}
168+
MMS_DEPLOYED_SHA_URL: ${{secrets.mms_deployed_sha_url}}
169+
run: |
170+
sha=$(curl "${MMS_DEPLOYED_SHA_URL}")
171+
echo "Downloading the OpenAPI Spec for v1 with sha ${sha}"
172+
aws s3 cp "s3://${S3_BUCKET}/openapi/oas/mms-v1/${sha}.json" "v1.json"
173+
- name: Generate YAML spec
174+
run: |
175+
sudo apt install yq
176+
yq -P '.' v1.json > v1.yaml
177+
- name: Upload artifact
178+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
179+
with:
180+
name: openapi-v1-${{ inputs.env }}
181+
path: |
182+
v1.json
183+
v1.yaml
184+
- name: Checkout repository
185+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
186+
with:
187+
ref: ${{ inputs.branch }}
188+
token: ${{secrets.api_bot_pat}}
189+
- name: Download artifact
190+
uses: actions/download-artifact@v4
191+
with:
192+
name: openapi-v1-${{ inputs.env }}
193+
github-token: ${{ secrets.api_bot_pat }}
194+
run-id: ${{ github.run_id }}
195+
path: openapi/v1-deprecated
196+
- name: Commit changes
197+
id: commit
198+
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842
199+
env:
200+
target_env: ${{ inputs.env }}
201+
target_branch: ${{ inputs.branch }}
202+
run_id: ${{ github.run_id }}
203+
with:
204+
commit_message: "(${{env.target_env}}) Release OpenAPI Spec V1 :rocket:. See https://github.com/mongodb/openapi/actions/runs/${{env.run_id}}."
205+
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
206+
branch: ${{env.target_branch}}
207+
file_pattern: "openapi/v1-deprecated/*"
208+
156209
release-postman:
157210
name: Release Postman
158211
needs: [release]

0 commit comments

Comments
 (0)