Postman Release #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Postman Release | |
on: | |
schedule: | |
- cron: '0 10 ? * *' | |
workflow_dispatch: | |
permissions: | |
issues: write | |
jobs: | |
release-postman: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
## Will be removed after CLOUDP-263207 | |
- name: Fetch Collection | |
working-directory: ./tools/postman | |
run: | | |
make fetch_openapi | |
- name: Compute checksum for current OpenAPI Specification | |
working-directory: ./tools/postman/openapi | |
run: | | |
checksum=$(sha256sum atlas-api.json | cut -d ' ' -f 1) | |
echo "checksum=$checksum" >> "$GITHUB_ENV" | |
- name: Check if checksum is saved in the cache | |
id: check-cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./tools/postman/openapi/openapi-checksum.txt | |
key: postman-openapi-${{ env.checksum }} | |
- name: Convert the OpenAPI Specification into Collection | |
if: steps.check-cache.outputs.cache-hit != 'true' | |
id: convert | |
working-directory: ./tools/postman | |
run: | | |
make convert_to_collection | |
- name: Create Issue | |
if: ${{ failure() && steps.convert.outcome == 'failure' }} | |
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd | |
with: | |
labels: failed-release | |
title: "Postman Release: `make convert_to_collection` command failed :scream_cat:" | |
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Collection to Postman | |
if: steps.check-cache.outputs.cache-hit != 'true' | |
env: | |
BASE_URL: ${{ vars.ATLAS_PROD_BASE_URL }} | |
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }} | |
WORKSPACE_ID: ${{ secrets.WORKSPACE_ID }} | |
working-directory: ./tools/postman | |
run: | | |
make upload_collection | |
- name: Save new checksum to file | |
if: steps.check-cache.outputs.cache-hit != 'true' | |
working-directory: ./tools/postman/openapi | |
run: | | |
echo "${{ env.checksum }}" > openapi-checksum.txt | |
- name: Cache new checksum file | |
if: steps.check-cache.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v4 | |
with: | |
path: ./tools/postman/openapi/openapi-checksum.txt | |
key: postman-openapi-${{ env.checksum }} |