Skip to content

CLOUDP-323790: Update foas release process to support bump.sh deployment for all the envs #752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 11, 2025
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
104 changes: 62 additions & 42 deletions .github/workflows/generate-bump-pages.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name: Check & deploy API documentation

name: Release the OpenAPI spec to Bump.sh
on:
# For deployments
workflow_dispatch: # Allow manual trigger in case of quick fix
push:
branches:
- main
paths:
- 'openapi/**.json'

# For previews
pull_request:
branches:
- main
paths:
- 'openapi/**.json'
workflow_call:
inputs:
atlas_admin_v1_doc_id:
description: 'Bump Doc ID for the v1 spec'
required: true
type: string
atlas_admin_v2_doc_id:
description: 'Bump Doc ID for the v2 specs'
required: true
type: string
branch:
description: 'Branch to release the OpenAPI Spec to.'
required: true
type: string
secrets:
api_bot_pat:
required: true
bump_token:
required: true

permissions:
contents: read
Expand All @@ -27,52 +31,68 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
token: ${{secrets.api_bot_pat}}
- name: Setup Node
uses: actions/setup-node@v4
- name: Download release scripts
uses: actions/download-artifact@v4
with:
name: release-scripts
github-token: ${{ secrets.api_bot_pat }}
run-id: ${{ github.run_id }}
path: release-scripts
- name: Add permissions to execute scripts
run: chmod +x release-scripts/*.js
- name: Generate matrix
id: set-matrix
env:
ATLAS_ADMIN_V1_DOC_ID: ${{ vars.ATLAS_ADMIN_V1_DOC_ID }}
ATLAS_ADMIN_V2_DOC_ID: ${{ vars.ATLAS_ADMIN_V2_DOC_ID }}
ATLAS_ADMIN_V1_DOC_ID: ${{ inputs.atlas_admin_v1_doc_id }}
ATLAS_ADMIN_V2_DOC_ID: ${{ inputs.atlas_admin_v1_doc_id }}
run: |
spec_mapping=$(node .github/scripts/generateSpecMapping.js)
spec_mapping=$(node release-scripts/generateSpecMapping.js)
echo "matrix=$spec_mapping" >> "$GITHUB_OUTPUT"

deploy-doc:
needs: create-matrix
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
name: Deploy API documentation on Bump.sh
strategy:
matrix:
spec-mapping: ${{ fromJson(needs.create-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v4
- name: Deploy API documentation
uses: bump-sh/github-action@59eaae922e81ac8d127bd2b2ac6dc4804bda8a4c
with:
doc: ${{matrix.spec-mapping.doc}}
token: ${{secrets.BUMP_TOKEN}}
file: ${{matrix.spec-mapping.file}}
branch: ${{matrix.spec-mapping.branch}}

api-preview:
needs: create-matrix
if: ${{ github.event_name == 'pull_request' }}
name: Create API preview on Bump.sh
strategy:
matrix:
spec-mapping: ${{ fromJSON(needs.create-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create API preview
ref: ${{ inputs.branch }}
token: ${{secrets.api_bot_pat}}
- name: Deploy API documentation - ${{inputs.branch}}
uses: bump-sh/github-action@59eaae922e81ac8d127bd2b2ac6dc4804bda8a4c
with:
doc: ${{matrix.spec-mapping.doc}}
token: ${{secrets.BUMP_TOKEN}}
token: ${{secrets.bump_token}}
file: ${{matrix.spec-mapping.file}}
branch: ${{matrix.spec-mapping.branch}}
command: preview

# We don't need to preview the API since the PR is autogenerated and always merge into master
# we will migrate this logic to another workflow that can be trigger ondemand by adding a label to a PR.
# api-preview:
# needs: create-matrix
# if: ${{ github.event_name == 'pull_request'}}
# name: Create API preview on Bump.sh
# strategy:
# matrix:
# spec-mapping: ${{ fromJSON(needs.create-matrix.outputs.matrix) }}
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Create API preview
# uses: bump-sh/github-action@59eaae922e81ac8d127bd2b2ac6dc4804bda8a4c
# with:
# doc: ${{matrix.spec-mapping.doc}}
# token: ${{secrets.bump_token}}
# file: ${{matrix.spec-mapping.file}}
# branch: ${{matrix.spec-mapping.branch}}
# command: preview
12 changes: 12 additions & 0 deletions .github/workflows/release-spec-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
secrets:
api_bot_pat: ${{ secrets.API_BOT_PAT }}
jira_api_token: ${{ secrets.JIRA_API_TOKEN }}
bump_token: ${{secrets.BUMP_TOKEN}}
with:
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
aws_s3_bucket: ${{ vars.S3_BUCKET_DEV}}
Expand All @@ -60,6 +61,8 @@ jobs:
branch: dev
spectral_version: ${{ vars.SPECTRAL_VERSION }}
foascli_version: ${{ vars.FOASCLI_VERSION }}
atlas_admin_v2_doc_id: ${{vars.ATLAS_ADMIN_V2_DOC_ID_DEV }}
atlas_admin_v1_doc_id: ${{vars.ATLAS_ADMIN_V1_DOC_ID_DEV }}
release-spec-qa:
name: Release OpenAPI Spec for QA
needs: release-preparation
Expand All @@ -69,6 +72,7 @@ jobs:
secrets:
api_bot_pat: ${{ secrets.API_BOT_PAT }}
jira_api_token: ${{ secrets.JIRA_API_TOKEN }}
bump_token: ${{secrets.BUMP_TOKEN}}
with:
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
aws_s3_role_to_assume: ${{ vars.AWS_S3_ROLE_TO_ASSUME }}
Expand All @@ -77,6 +81,8 @@ jobs:
branch: qa
spectral_version: ${{ vars.SPECTRAL_VERSION }}
foascli_version: ${{ vars.FOASCLI_VERSION }}
atlas_admin_v2_doc_id: ${{vars.ATLAS_ADMIN_V2_DOC_ID_QA }}
atlas_admin_v1_doc_id: ${{vars.ATLAS_ADMIN_V1_DOC_ID_QA }}
release-spec-staging:
name: Release OpenAPI Spec for STAGING
needs: release-preparation
Expand All @@ -86,6 +92,7 @@ jobs:
secrets:
api_bot_pat: ${{ secrets.API_BOT_PAT }}
jira_api_token: ${{ secrets.JIRA_API_TOKEN }}
bump_token: ${{secrets.BUMP_TOKEN}}
with:
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
aws_s3_role_to_assume: ${{ vars.AWS_S3_ROLE_TO_ASSUME }}
Expand All @@ -94,6 +101,8 @@ jobs:
branch: staging
spectral_version: ${{ vars.SPECTRAL_VERSION }}
foascli_version: ${{ vars.FOASCLI_VERSION }}
atlas_admin_v2_doc_id: ${{vars.ATLAS_ADMIN_V2_DOC_ID_STAGING }}
atlas_admin_v1_doc_id: ${{vars.ATLAS_ADMIN_V1_DOC_ID_STAGING }}
release-spec-prod:
name: Release OpenAPI Spec for PROD
needs: release-preparation
Expand All @@ -105,6 +114,7 @@ jobs:
postman_api_key: ${{ secrets.POSTMAN_API_KEY }}
workspace_id: ${{ secrets.WORKSPACE_ID }}
jira_api_token: ${{ secrets.JIRA_API_TOKEN }}
bump_token: ${{secrets.BUMP_TOKEN}}
with:
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
aws_s3_role_to_assume: ${{ vars.AWS_S3_ROLE_TO_ASSUME }}
Expand All @@ -114,6 +124,8 @@ jobs:
spectral_version: ${{ vars.SPECTRAL_VERSION }}
foascli_version: ${{ vars.FOASCLI_VERSION }}
atlas_prod_base_url: ${{ vars.ATLAS_PROD_BASE_URL }}
atlas_admin_v2_doc_id: ${{vars.ATLAS_ADMIN_V2_DOC_ID }}
atlas_admin_v1_doc_id: ${{vars.ATLAS_ADMIN_V1_DOC_ID }}

release-spec-v1-prod:
name: Release OpenAPI Spec V1 (Deprecated) for PROD
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/release-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ on:
description: 'AWS S3 Role to Assume.'
required: true
type: string
atlas_admin_v1_doc_id:
description: 'Bump Doc ID for the v1 spec'
required: true
type: string
atlas_admin_v2_doc_id:
description: 'Bump Doc ID for the v2 specs'
required: true
type: string
secrets: # all secrets are passed explicitly in this workflow
api_bot_pat:
required: true
Expand All @@ -49,6 +57,8 @@ on:
required: false
ipa_aws_s3_bucket_prefix:
required: false
bump_token:
required: true

permissions:
contents: write
Expand Down Expand Up @@ -184,6 +194,19 @@ jobs:
branch: ${{ inputs.branch }}
foascli_version: ${{ inputs.foascli_version }}

release-bump-sh:
name: Release API Specification to Bump.sh for ${{ inputs.branch }}
needs: release
if: ${{needs.release.outputs.changes_detected == 'true'}}
uses: ./.github/workflows/generate-bump-pages.yml
secrets:
api_bot_pat: ${{ secrets.api_bot_pat }}
bump_token: ${{ secrets.bump_token }}
with:
branch: ${{ inputs.branch }}
atlas_admin_v1_doc_id: ${{ inputs.atlas_admin_v1_doc_id }}
atlas_admin_v2_doc_id: ${{ inputs.atlas_admin_v2_doc_id }}

release-cleanup:
needs: [ release, release-changelog]
uses: ./.github/workflows/release-cleanup.yml
Expand Down