Skip to content

Commit d7bd5dc

Browse files
authored
ELI-338 workflow enhancement (#308)
* adding new workflows and removing unused ones * removing more redundant workflows and adding more functionality to dev workflow * added tagging control
1 parent 34f7856 commit d7bd5dc

9 files changed

Lines changed: 184 additions & 532 deletions

.github/workflows/cicd-2-publish.yaml

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

.github/workflows/cicd-3-deploy.yaml

Lines changed: 0 additions & 74 deletions
This file was deleted.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Deploy to Dev and Sandbox
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
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+
26+
dev:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v6
30+
- uses: actions/setup-python@v6
31+
with:
32+
python-version: '3.11'
33+
- uses: actions/setup-node@v6
34+
with:
35+
node-version: '20'
36+
- run: make install
37+
- run: make construct-spec APIM_ENV=dev
38+
- run: make publish-spec APIM_ENV=dev
39+
- run: make deploy-spec APIM_ENV=dev
40+
41+
sandbox:
42+
needs: dev
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v6
46+
- uses: actions/setup-python@v6
47+
with:
48+
python-version: '3.11'
49+
- uses: actions/setup-node@v6
50+
with:
51+
node-version: '20'
52+
- run: make install
53+
- run: make construct-spec APIM_ENV=sandbox
54+
- run: make generate-sandbox-spec
55+
- run: make deploy-sandbox-spec
56+
- 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+
triggered_by: "${{ github.actor }}"
101+
environment: "Specification updated in Dev & Sandbox"
102+
version: "${{ needs.metadata.outputs.version }}"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy to Preprod
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: "Tag to promote (e.g. spec-{timestamp})"
8+
default: latest
9+
required: true
10+
11+
jobs:
12+
preprod:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
- name: Set tag to deploy
17+
id: set_tag
18+
run: |
19+
if [ "${{ github.event.inputs.ref }}" = "latest" ]; then
20+
TAG=$(git tag --list 'spec-*' --sort=-v:refname | head -n 1)
21+
echo "Using latest tag: $TAG"
22+
echo "tag=$TAG" >> $GITHUB_OUTPUT
23+
else
24+
echo "tag=${{ github.event.inputs.ref }}" >> $GITHUB_OUTPUT
25+
fi
26+
- name: Checkout tag
27+
uses: actions/checkout@v6
28+
with:
29+
ref: ${{ steps.set_tag.outputs.tag }}
30+
- uses: actions/setup-python@v6
31+
with:
32+
python-version: '3.11'
33+
- uses: actions/setup-node@v6
34+
with:
35+
node-version: '20'
36+
- run: make install
37+
- run: make construct-spec APIM_ENV=preprod
38+
- run: make publish-spec APIM_ENV=preprod
39+
- run: make deploy-spec APIM_ENV=preprod
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Deploy to Prod
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: "Tag to promote (e.g. spec-{timestamp})"
8+
required: true
9+
10+
jobs:
11+
prod:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v6
15+
- name: Checkout tag
16+
uses: actions/checkout@v6
17+
with:
18+
ref: ${{ inputs.ref }}
19+
- uses: actions/setup-python@v6
20+
with:
21+
python-version: '3.11'
22+
- uses: actions/setup-node@v6
23+
with:
24+
node-version: '20'
25+
- run: make install
26+
- run: make construct-spec APIM_ENV=prod
27+
- run: make publish-spec APIM_ENV=prod
28+
- run: make deploy-spec APIM_ENV=prod
29+
30+
create_release:
31+
needs: prod
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Create GitHub Release
35+
uses: actions/create-release@v1
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
with:
39+
tag_name: ${{ inputs.ref }}
40+
release_name: Release ${{ inputs.ref }}
41+
draft: false
42+
prerelease: false

0 commit comments

Comments
 (0)