Skip to content

Commit e542a64

Browse files
committed
removing more redundant workflows and adding more functionality to dev workflow
1 parent 4ed5738 commit e542a64

5 files changed

Lines changed: 65 additions & 363 deletions

File tree

.github/workflows/dev_sandbox_publish_deploy.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ on:
66
- main
77

88
jobs:
9+
metadata:
10+
name: "Set CI/CD metadata"
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 1
13+
outputs:
14+
version: ${{ steps.variables.outputs.version }}
15+
steps:
16+
- name: "Set CI/CD variables"
17+
id: variables
18+
run: |
19+
echo "version=spec-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
20+
21+
- name: "List variables"
22+
run: |
23+
echo "Deploying to: DEV & Sandbox"
24+
echo "VERSION=${{ steps.variables.outputs.version }}"
25+
926
dev:
1027
runs-on: ubuntu-latest
1128
steps:
@@ -22,6 +39,7 @@ jobs:
2239
- run: make deploy-spec APIM_ENV=dev
2340

2441
sandbox:
42+
needs: dev
2543
runs-on: ubuntu-latest
2644
steps:
2745
- uses: actions/checkout@v6
@@ -36,3 +54,49 @@ jobs:
3654
- run: make generate-sandbox-spec
3755
- run: make deploy-sandbox-spec
3856
- run: make build-and-publish-sandbox-image
57+
58+
publish_postman:
59+
needs: sandbox
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v6
63+
- name: Install dependencies
64+
run: make install
65+
- name: Generate Postman Collection
66+
run: make convert-postman
67+
- name: Publish Postman Collection
68+
env:
69+
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}
70+
run: |
71+
curl --fail -X PUT \
72+
https://api.getpostman.com/collections/{{YOUR_COLLECTION_UID}} \
73+
-H "X-Api-Key: $POSTMAN_API_KEY" \
74+
-H "Content-Type: application/json" \
75+
-d @specification/postman/collection.json
76+
77+
publish:
78+
needs: publish_postman
79+
runs-on: ubuntu-latest
80+
steps:
81+
- name: "Tag the dev & sandbox deployment"
82+
run: |
83+
git config user.name "github-actions"
84+
git config user.email "github-actions@github.com"
85+
git tag ${{ needs.metadata.outputs.version }}
86+
git push origin ${{ needs.metadata.outputs.version }}
87+
88+
notify_slack:
89+
needs: publish
90+
runs-on: ubuntu-latest
91+
steps:
92+
- name: "Notify Slack on PR merge"
93+
uses: slackapi/slack-github-action@v2.1.1
94+
with:
95+
webhook: ${{ secrets.SLACK_WORKFLOW_WEBHOOK_URL }}
96+
webhook-type: webhook-trigger
97+
payload: |
98+
status: "${{ job.status }}"
99+
link: "https://github.com/${{ github.repository }}/commit/${{ github.sha }}"
100+
author: "${{ github.actor }}"
101+
title: "Pushed to main"
102+
version: "${{ needs.metadata.outputs.version }}"

.github/workflows/cicd-1-pull-request.yaml renamed to .github/workflows/pull-request.yaml

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ name: "CI/CD pull request"
33
# The total recommended execution time for the "CI/CD Pull Request" workflow is around 20 minutes.
44

55
on:
6-
push:
7-
branches:
8-
- "**"
96
pull_request:
10-
types: [opened, reopened]
7+
types: [opened, synchronize, reopened]
118

129
jobs:
1310
metadata:
@@ -75,41 +72,3 @@ jobs:
7572
python_version: "${{ needs.metadata.outputs.python_version }}"
7673
version: "${{ needs.metadata.outputs.version }}"
7774
secrets: inherit
78-
test-stage: # Recommended maximum execution time is 5 minutes
79-
name: "Test stage"
80-
needs: [metadata, commit-stage]
81-
uses: ./.github/workflows/stage-2-test.yaml
82-
with:
83-
build_datetime: "${{ needs.metadata.outputs.build_datetime }}"
84-
build_timestamp: "${{ needs.metadata.outputs.build_timestamp }}"
85-
build_epoch: "${{ needs.metadata.outputs.build_epoch }}"
86-
nodejs_version: "${{ needs.metadata.outputs.nodejs_version }}"
87-
python_version: "${{ needs.metadata.outputs.python_version }}"
88-
version: "${{ needs.metadata.outputs.version }}"
89-
secrets: inherit
90-
build-stage: # Recommended maximum execution time is 3 minutes
91-
name: "Build stage"
92-
needs: [metadata, test-stage]
93-
uses: ./.github/workflows/stage-3-build.yaml
94-
if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened'))
95-
with:
96-
build_datetime: "${{ needs.metadata.outputs.build_datetime }}"
97-
build_timestamp: "${{ needs.metadata.outputs.build_timestamp }}"
98-
build_epoch: "${{ needs.metadata.outputs.build_epoch }}"
99-
nodejs_version: "${{ needs.metadata.outputs.nodejs_version }}"
100-
python_version: "${{ needs.metadata.outputs.python_version }}"
101-
version: "${{ needs.metadata.outputs.version }}"
102-
secrets: inherit
103-
acceptance-stage: # Recommended maximum execution time is 10 minutes
104-
name: "Acceptance stage"
105-
needs: [metadata, build-stage]
106-
uses: ./.github/workflows/stage-4-acceptance.yaml
107-
if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened'))
108-
with:
109-
build_datetime: "${{ needs.metadata.outputs.build_datetime }}"
110-
build_timestamp: "${{ needs.metadata.outputs.build_timestamp }}"
111-
build_epoch: "${{ needs.metadata.outputs.build_epoch }}"
112-
nodejs_version: "${{ needs.metadata.outputs.nodejs_version }}"
113-
python_version: "${{ needs.metadata.outputs.python_version }}"
114-
version: "${{ needs.metadata.outputs.version }}"
115-
secrets: inherit

.github/workflows/stage-2-test.yaml

Lines changed: 0 additions & 90 deletions
This file was deleted.

.github/workflows/stage-3-build.yaml

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)