|
1 | | -name: Build |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | permissions: |
4 | 4 | id-token: write |
5 | 5 | contents: write |
6 | 6 | issues: read |
| 7 | + pull-requests: read |
7 | 8 |
|
8 | 9 | on: |
9 | 10 | push: |
10 | 11 | pull_request: |
11 | 12 | types: [opened, synchronize, ready_for_review, reopened] |
12 | 13 |
|
13 | | -env: |
14 | | - CI_BUILD_NUM: ${{ github.run_id }} |
15 | | - CI_BRANCH: ${{ github.ref_name }} |
16 | | - HLX_AWS_REGION: ${{ secrets.AWS_REGION }} |
17 | 14 | jobs: |
18 | | - protect-nyc-config: |
19 | | - if: github.event_name == 'pull_request' |
20 | | - runs-on: ubuntu-latest |
21 | | - permissions: |
22 | | - contents: read |
23 | | - pull-requests: read |
24 | | - steps: |
25 | | - - name: Check out |
26 | | - uses: actions/checkout@v6 |
27 | | - with: |
28 | | - persist-credentials: 'false' |
29 | | - |
30 | | - - name: Protect NYC config |
31 | | - uses: ./.github/actions/protect-nyc-config |
32 | | - |
33 | | - build: |
34 | | - runs-on: ubuntu-latest |
35 | | - steps: |
36 | | - - name: Check out |
37 | | - uses: actions/checkout@v6 |
38 | | - with: |
39 | | - persist-credentials: 'false' |
40 | | - - name: Setup Node & NPM |
41 | | - uses: ./.github/actions/setup-node-npm |
42 | | - env: |
43 | | - MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN: ${{ secrets.MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN }} |
44 | | - |
45 | | - - name: Lint, Test, Coverage Upload |
46 | | - uses: ./.github/actions/lint-test-coverage |
47 | | - with: |
48 | | - upload_coverage: "true" |
49 | | - codecov_token: ${{ secrets.CODECOV_TOKEN }} |
50 | | - |
51 | | - - name: Semantic Release (Dry Run) |
52 | | - if: github.event_name == 'push' && github.ref != 'refs/heads/main' |
53 | | - run: npm run semantic-release-dry |
54 | | - env: |
55 | | - GITHUB_TOKEN: ${{ secrets.ADOBE_BOT_GITHUB_TOKEN }} |
56 | | - NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} |
57 | | - |
58 | | - - name: Print npm debug log if build fails |
59 | | - if: failure() |
60 | | - run: | |
61 | | - if [ -f /home/runner/.npm/_logs/*.log ]; then |
62 | | - echo "==== NPM DEBUG LOG ====" |
63 | | - find /home/runner/.npm/_logs -name '*.log' -exec cat {} \; |
64 | | - echo "==== END NPM DEBUG LOG ====" |
65 | | - else |
66 | | - echo "No npm debug log found." |
67 | | - fi |
68 | | -
|
69 | | - - name: Clean npm cache |
70 | | - run: npm cache clean --force |
71 | | - |
72 | | - - name: Create empty cache directory |
73 | | - run: mkdir -p /tmp/empty-cache |
74 | | - |
75 | | - - name: Install dependencies |
76 | | - run: npm ci --cache /tmp/empty-cache |
77 | | - |
78 | | - semantic-release: |
79 | | - runs-on: ubuntu-latest |
80 | | - needs: build |
81 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
82 | | - steps: |
83 | | - - name: Check out |
84 | | - uses: actions/checkout@v6 |
85 | | - with: |
86 | | - persist-credentials: 'false' |
87 | | - |
88 | | - - name: Configure Environment |
89 | | - run: echo -e "LOG_LEVEL=info\n" > .env |
90 | | - |
91 | | - - name: Setup Node & NPM |
92 | | - uses: ./.github/actions/setup-node-npm |
93 | | - env: |
94 | | - MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN: ${{ secrets.MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN }} |
95 | | - |
96 | | - - name: Configure AWS |
97 | | - uses: ./.github/actions/configure-aws |
98 | | - with: |
99 | | - aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_PROD}}:role/spacecat-role-github-actions' |
100 | | - |
101 | | - - name: Semantic Release |
102 | | - run: npm run semantic-release |
103 | | - env: |
104 | | - GITHUB_TOKEN: ${{ secrets.ADOBE_BOT_GITHUB_TOKEN }} |
105 | | - NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} |
106 | | - AWS_REGION: us-east-1 |
107 | | - AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_PROD}} |
108 | | - |
109 | | - deploy-stage: |
110 | | - runs-on: ubuntu-latest |
111 | | - needs: build |
112 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
113 | | - steps: |
114 | | - - name: Check out |
115 | | - uses: actions/checkout@v6 |
116 | | - with: |
117 | | - persist-credentials: 'false' |
118 | | - |
119 | | - - name: Setup Node & NPM |
120 | | - uses: ./.github/actions/setup-node-npm |
121 | | - env: |
122 | | - MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN: ${{ secrets.MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN }} |
123 | | - |
124 | | - - name: Configure AWS for STAGE |
125 | | - uses: ./.github/actions/configure-aws |
126 | | - with: |
127 | | - aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_STAGE}}:role/spacecat-role-github-actions' |
128 | | - |
129 | | - - name: Branch Deployment |
130 | | - run: npm run deploy-stage |
131 | | - env: |
132 | | - AWS_REGION: us-east-1 |
133 | | - AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_STAGE}} |
134 | | - |
135 | | - upload-build-artifacts: |
136 | | - runs-on: ubuntu-latest |
137 | | - needs: build |
138 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
139 | | - steps: |
140 | | - - name: Check out |
141 | | - uses: actions/checkout@v6 |
142 | | - with: |
143 | | - persist-credentials: 'false' |
144 | | - |
145 | | - - name: Setup Node & NPM |
146 | | - uses: ./.github/actions/setup-node-npm |
147 | | - env: |
148 | | - MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN: ${{ secrets.MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN }} |
149 | | - |
150 | | - - name: Configure AWS for DEV |
151 | | - uses: ./.github/actions/configure-aws |
152 | | - with: |
153 | | - aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_DEV}}:role/spacecat-role-github-actions' |
154 | | - |
155 | | - - name: Create Build Artifacts |
156 | | - run: npm run build |
157 | | - env: |
158 | | - AWS_REGION: us-east-1 |
159 | | - AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_DEV}} |
160 | | - |
161 | | - - name: Copy Build Artifact |
162 | | - run: cp dist/spacecat-services/task-processor@*.zip spacecat-services--task-processor-latest.zip |
163 | | - env: |
164 | | - AWS_REGION: us-east-1 |
165 | | - AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_DEV}} |
166 | | - |
167 | | - - name: Upload Build Artifact |
168 | | - run: aws s3 cp spacecat-services--task-processor-latest.zip s3://spacecat-artifacts-dev/spacecat-services--task-processor-latest.zip |
169 | | - env: |
170 | | - AWS_REGION: us-east-1 |
171 | | - AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_DEV}} |
172 | | - |
173 | | - branch-deploy: |
174 | | - runs-on: ubuntu-latest |
175 | | - needs: build |
176 | | - if: github.event_name == 'push' && github.ref != 'refs/heads/main' |
177 | | - steps: |
178 | | - - name: Check out |
179 | | - uses: actions/checkout@v6 |
180 | | - with: |
181 | | - persist-credentials: 'false' |
182 | | - |
183 | | - - name: Setup Node & NPM |
184 | | - uses: ./.github/actions/setup-node-npm |
185 | | - env: |
186 | | - MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN: ${{ secrets.MYSTICAT_DATA_SERVICE_REPO_READ_TOKEN }} |
187 | | - |
188 | | - - name: Configure AWS |
189 | | - uses: ./.github/actions/configure-aws |
190 | | - with: |
191 | | - aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_DEV}}:role/spacecat-role-github-actions' |
192 | | - |
193 | | - - name: Branch Deployment |
194 | | - run: npm run deploy-dev |
195 | | - env: |
196 | | - AWS_REGION: us-east-1 |
197 | | - AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_DEV}} |
198 | | - |
199 | | - - name: Post-Deployment Integration Test |
200 | | - run: npm run test-postdeploy |
| 15 | + ci: |
| 16 | + uses: adobe/mysticat-ci/.github/workflows/service-ci.yaml@v1 |
| 17 | + with: |
| 18 | + service-name: task-processor |
| 19 | + secrets: inherit |
0 commit comments