-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdev_sandbox_publish_deploy.yaml
More file actions
102 lines (94 loc) · 2.96 KB
/
dev_sandbox_publish_deploy.yaml
File metadata and controls
102 lines (94 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Deploy to Dev and Sandbox
on:
push:
branches:
- main
jobs:
metadata:
name: "Set CI/CD metadata"
runs-on: ubuntu-latest
timeout-minutes: 1
outputs:
version: ${{ steps.variables.outputs.version }}
steps:
- name: "Set CI/CD variables"
id: variables
run: |
echo "version=spec-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: "List variables"
run: |
echo "Deploying to: DEV & Sandbox"
echo "VERSION=${{ steps.variables.outputs.version }}"
dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.11'
- uses: actions/setup-node@v6
with:
node-version: '20'
- run: make install
- run: make construct-spec APIM_ENV=dev
- run: make publish-spec APIM_ENV=dev
- run: make deploy-spec APIM_ENV=dev
sandbox:
needs: dev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.11'
- uses: actions/setup-node@v6
with:
node-version: '20'
- run: make install
- run: make construct-spec APIM_ENV=sandbox
- run: make generate-sandbox-spec
- run: make deploy-sandbox-spec
- run: make build-and-publish-sandbox-image
publish_postman:
needs: sandbox
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: make install
- name: Generate Postman Collection
run: make convert-postman
- name: Publish Postman Collection
env:
POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }}
run: |
curl --fail -X PUT \
https://api.getpostman.com/collections/{{YOUR_COLLECTION_UID}} \
-H "X-Api-Key: $POSTMAN_API_KEY" \
-H "Content-Type: application/json" \
-d @specification/postman/collection.json
publish:
needs: publish_postman
runs-on: ubuntu-latest
steps:
- name: "Tag the dev & sandbox deployment"
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag ${{ needs.metadata.outputs.version }}
git push origin ${{ needs.metadata.outputs.version }}
notify_slack:
needs: publish
runs-on: ubuntu-latest
steps:
- name: "Notify Slack on PR merge"
uses: slackapi/slack-github-action@v2.1.1
with:
webhook: ${{ secrets.SLACK_WORKFLOW_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
status: "${{ job.status }}"
link: "https://github.com/${{ github.repository }}/commit/${{ github.sha }}"
triggered_by: "${{ github.actor }}"
environment: "Specification updated in Dev & Sandbox"
version: "${{ needs.metadata.outputs.version }}"