-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (113 loc) · 3.75 KB
/
ci.yaml
File metadata and controls
137 lines (113 loc) · 3.75 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
name: Build
permissions:
id-token: write
contents: write
issues: read
on: [push]
env:
CI_BUILD_NUM: ${{ github.run_id }}
CI_BRANCH: ${{ github.ref_name }}
HLX_AWS_REGION: ${{ secrets.AWS_REGION }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
with:
persist-credentials: 'false'
- name: Setup Node & NPM
uses: ./.github/actions/setup-node-npm
- 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.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 }}
- name: Print npm debug log if build fails
if: failure()
run: |
if [ -f /home/runner/.npm/_logs/*.log ]; then
echo "==== NPM DEBUG LOG ===="
find /home/runner/.npm/_logs -name '*.log' -exec cat {} \;
echo "==== END NPM DEBUG LOG ===="
else
echo "No npm debug log found."
fi
- name: Clean npm cache
run: npm cache clean --force
- name: Create empty cache directory
run: mkdir -p /tmp/empty-cache
- name: Install dependencies
run: npm ci --cache /tmp/empty-cache
semantic-release:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Check out
uses: actions/checkout@v4
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
- name: Configure AWS
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.ref == 'refs/heads/main'
steps:
- name: Check out
uses: actions/checkout@v4
with:
persist-credentials: 'false'
- name: Setup Node & NPM
uses: ./.github/actions/setup-node-npm
- 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}}
branch-deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref != 'refs/heads/main'
steps:
- name: Check out
uses: actions/checkout@v4
with:
persist-credentials: 'false'
- name: Setup Node & NPM
uses: ./.github/actions/setup-node-npm
- 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