-
Notifications
You must be signed in to change notification settings - Fork 10
193 lines (165 loc) · 5.9 KB
/
ci.yaml
File metadata and controls
193 lines (165 loc) · 5.9 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Build
permissions:
id-token: write
contents: write
issues: read
on:
push:
pull_request:
types: [opened, synchronize, ready_for_review, reopened, edited]
env:
CI_BUILD_NUM: ${{ github.run_id }}
CI_BRANCH: ${{ github.ref_name }}
HLX_AWS_REGION: ${{ secrets.AWS_REGION }}
jobs:
validate-pr-title:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Validate PR title
uses: amannn/action-semantic-pull-request@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
protect-nyc-config:
if: github.event_name == 'pull_request' && github.event.action != 'edited'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- name: Check out
uses: actions/checkout@v5
with:
persist-credentials: 'false'
- name: Protect NYC config
uses: ./.github/actions/protect-nyc-config
build:
if: github.event_name == 'push' || github.event.action != 'edited'
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v5
with:
persist-credentials: 'false'
- name: Setup Node & NPM
uses: ./.github/actions/setup-node-npm
env:
MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN: ${{ secrets.MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN }}
- name: Lint, Test, Coverage Upload
uses: ./.github/actions/lint-test-coverage
with:
upload_coverage: "true"
codecov_token: ${{ secrets.CODECOV_TOKEN }}
- name: Semantic Release (Dry Run)
if: github.event_name == 'push' && github.ref != 'refs/heads/main'
run: npm run semantic-release-dry
env:
GITHUB_TOKEN: ${{ secrets.ADOBE_BOT_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
semantic-release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Check out
uses: actions/checkout@v5
with:
persist-credentials: 'false'
- name: Configure Environment
run: echo -e "LOG_LEVEL=info\n" > .env
- name: Setup Node & NPM
uses: ./.github/actions/setup-node-npm
env:
MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN: ${{ secrets.MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN }}
- name: Configure AWS for PROD
uses: ./.github/actions/configure-aws
with:
aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_PROD}}:role/spacecat-role-github-actions'
- name: Semantic Release
run: npm run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.ADOBE_BOT_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }}
AWS_REGION: us-east-1
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_PROD}}
deploy-stage:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Check out
uses: actions/checkout@v5
with:
persist-credentials: 'false'
- name: Setup Node & NPM
uses: ./.github/actions/setup-node-npm
env:
MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN: ${{ secrets.MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN }}
- name: Configure AWS for STAGE
uses: ./.github/actions/configure-aws
with:
aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_STAGE}}:role/spacecat-role-github-actions'
- name: Branch Deployment
run: npm run deploy-stage
env:
AWS_REGION: us-east-1
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_STAGE}}
upload-build-artifacts:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Check out
uses: actions/checkout@v5
with:
persist-credentials: 'false'
- name: Setup Node & NPM
uses: ./.github/actions/setup-node-npm
env:
MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN: ${{ secrets.MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN }}
- name: Configure AWS for DEV
uses: ./.github/actions/configure-aws
with:
aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_DEV}}:role/spacecat-role-github-actions'
- name: Create Build Artifacts
run: npm run build
env:
AWS_REGION: us-east-1
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_DEV}}
- name: Copy Build Artifact
run: cp dist/spacecat-services/api-service@*.zip spacecat-services--api-service-latest.zip
env:
AWS_REGION: us-east-1
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_DEV}}
- name: Upload ZIP File
run: aws s3 cp spacecat-services--api-service-latest.zip s3://spacecat-artifacts-dev/spacecat-services--api-service-latest.zip
env:
AWS_REGION: us-east-1
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_DEV}}
branch-deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref != 'refs/heads/main'
steps:
- name: Check out
uses: actions/checkout@v5
with:
persist-credentials: 'false'
- name: Setup Node & NPM
uses: ./.github/actions/setup-node-npm
env:
MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN: ${{ secrets.MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN }}
- name: Configure AWS
uses: ./.github/actions/configure-aws
with:
aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_DEV}}:role/spacecat-role-github-actions'
- name: Branch Deployment
run: npm run deploy-dev
env:
AWS_REGION: us-east-1
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_DEV}}
- name: Post-Deployment Integration Test
run: npm run test-postdeploy