Skip to content

(PROD) Release OpenAPI Spec #75

(PROD) Release OpenAPI Spec

(PROD) Release OpenAPI Spec #75

name: '(PROD) Release OpenAPI Spec'
on:
workflow_dispatch: {}
schedule:
- cron: '0 9 * * *' # Run at 9AM UTC
permissions:
contents: write
pull-requests: write
issues: write
jobs:
generata-spec:
name: Run Required Validations
uses: ./.github/workflows/generate-openapi.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: us-east-1
aws_s3_bucket: ${{ vars.S3_BUCKET_PROD}}
# Required validations will stop the release if they fail
run-required-validations:
name: Run Required Validations
needs: generata-spec
uses: ./.github/workflows/required-spec-validations.yml
secrets:
api_bot_pat: ${{ secrets.API_BOT_PAT }}
with:
spectral_version: ${{ vars.SPECTRAL_VERSION }}
# Optional validations won't stop the release but only open a GH issue if they fail
run-optional-validations:
name: Run Optional Validations
needs: generata-spec
uses: ./.github/workflows/optional-spec-validations.yml
secrets:
api_bot_pat: ${{ secrets.API_BOT_PAT }}
release:
name: Release OpenAPI Spec
runs-on: ubuntu-latest
needs: [run-required-validations]
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Install Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version-file: 'tools/cli/go.mod'
cache-dependency-path: "tools/cli/go.sum"
- name: Run foascli split command
run: |
pushd tools/cli
make build
popd
./tools/cli/bin/foascli split -s ./tools/cli/test/data/openapi-foas-dev.json --env prod -o ./openapi/v2/openapi.json
cp -rf "./tools/cli/test/data/openapi-foas-dev.json" "./openapi/v2.json"
./tools/cli/bin/foascli split -s ./tools/cli/test/data/openapi-foas-dev.yaml --env prod -o ./openapi/v2/openapi.yaml
cp -rf "./tools/cli/test/data/openapi-foas-dev.yaml" "./openapi/v2.yaml"
- name: Create Issue
if: ${{ failure() }}
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd
with:
labels: failed-release
title: "(PROD) Release: `foascli split` command failed :scream_cat:"
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
token: ${{ secrets.api_bot_pat }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "release: (PROD) Release OpenAPI Spec :rocket:"
commit-message: "release: (PROD) Release OpenAPI Spec :rocket:"
delete-branch: true
branch: api-bot-update
labels: |
release
body: |
Automatic Release for MongoDB Atlas OpenAPI Specification.
PR contains autogenerated changes of the OpenAPI specification based on the latest services deployed in production.
- name: Create Issue
if: ${{ failure() }}
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd
with:
labels: failed-release
title: "(PROD) Release: `Create Pull Request` step failed :scream_cat:"
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
token: ${{ secrets.api_bot_pat }}