Skip to content

Commit

Permalink
CLOUDP-269087: Update FOAS prod release process to stop creating PR (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaangiolillo authored Aug 21, 2024
1 parent f591b1a commit 93fb8d5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 118 deletions.
13 changes: 5 additions & 8 deletions .github/scripts/split_spec.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#!/usr/bin/env bash
set -eou pipefail

env_flag=${target_env:?}
if [[ ${env_flag} == "staging" ]]; then
env_flag="stage"
fi
echo "Running FOAS CLI versions command"
foascli versions -s openapi-foas.json -o ./openapi/v2/versions.json --env "${target_env:?}"

echo "Running FOAS CLI split command with the following --env=${env_flag} and -o=./openapi/v2/openapi.json"
echo "Running FOAS CLI split command with the following --env=${target_env:?} and -o=./openapi/v2/openapi.json"

foascli split -s openapi-foas.json --env "${env_flag}" -o ./openapi/v2/openapi.json
foascli split -s openapi-foas.json --env "${target_env:?}" -o ./openapi/v2/openapi.json
mv -f "openapi-foas.json" "./openapi/v2.json"

foascli split -s openapi-foas.yaml --env "${env_flag}" -o ./openapi/v2/openapi.yaml
foascli split -s openapi-foas.yaml --env "${target_env:?}" -o ./openapi/v2/openapi.yaml
mv -f "openapi-foas.yaml" "./openapi/v2.yaml"

106 changes: 0 additions & 106 deletions .github/workflows/release-spec-prod.yml

This file was deleted.

21 changes: 19 additions & 2 deletions .github/workflows/release-spec-runner.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Release Runner: Start the Release Process for DEV, QA, and STAGING'
name: 'Release Runner: Start the Release Process for DEV, QA, STAGING and PROD'
on:
workflow_dispatch: {}
schedule:
Expand All @@ -20,6 +20,7 @@ jobs:
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
aws_s3_bucket: ${{ vars.S3_BUCKET_DEV}}
env: dev
branch: dev
spectral_version: ${{ vars.SPECTRAL_VERSION }}
foascli_version: ${{ vars.FOASCLI_VERSION }}
release-spec-qa:
Expand All @@ -33,6 +34,7 @@ jobs:
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
aws_s3_bucket: ${{ vars.S3_BUCKET_QA}}
env: qa
branch: qa
spectral_version: ${{ vars.SPECTRAL_VERSION }}
foascli_version: ${{ vars.FOASCLI_VERSION }}
release-spec-staging:
Expand All @@ -45,6 +47,21 @@ jobs:
with:
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
aws_s3_bucket: ${{ vars.S3_BUCKET_STAGING}}
env: staging
env: stage
branch: staging
spectral_version: ${{ vars.SPECTRAL_VERSION }}
foascli_version: ${{ vars.FOASCLI_VERSION }}
release-spec-prod:
name: Release OpenAPI Spec for PROD
uses: ./.github/workflows/release-spec.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 }}
with:
aws_default_region: ${{ vars.AWS_DEFAULT_REGION}}
aws_s3_bucket: ${{ vars.S3_BUCKET_PROD}}
env: prod
branch: main
spectral_version: ${{ vars.SPECTRAL_VERSION }}
foascli_version: ${{ vars.FOASCLI_VERSION }}
19 changes: 17 additions & 2 deletions .github/workflows/release-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
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
spectral_version:
description: 'Version of Spectral to use.'
required: true
Expand Down Expand Up @@ -77,7 +81,17 @@ jobs:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
ref: ${{ inputs.env }}
ref: ${{ inputs.branch }}
- name: Upload current Specs and Changelog files
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
with:
name: base-${{ inputs.env }}
retention-days: 1
path: |
openapi/v2/openapi*.json
changelog/changelog.json
changelog/internal/changelog-all.json
changelog/internal/metadata.json
- name: Download openapi-foas
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -118,10 +132,11 @@ jobs:
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842
env:
target_env: ${{ inputs.env }}
target_branch: ${{ inputs.branch }}
with:
commit_message: "(${{env.target_env}}) Release OpenAPI Spec :rocket:"
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
branch: ${{env.target_env}}
branch: ${{env.target_branch}}
file_pattern: "openapi/*"
- name: Create Issue
if: ${{ failure() && steps.commit.outcome == 'failure' }}
Expand Down

0 comments on commit 93fb8d5

Please sign in to comment.