-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (107 loc) · 4.28 KB
/
bdt-fe.yml
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
name: 🚜 Build, Deploy, and Test
run-name: "🚜 ${{ github.ref_name == 'main' && 'PRD' || 'STG' }} - Build, Deploy, and Test - ${{ github.event_name == 'pull_request' && format('PR #{0}: {1}', github.event.pull_request.number, github.event.pull_request.title) || format('latest {0}', github.ref_name) }}"
on:
workflow_dispatch:
pull_request:
paths:
- "front/**"
branches: [main, develop]
push:
paths:
- "front/**"
branches: [main, develop]
permissions:
checks: write
contents: write
pull-requests: write
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
build_deploy:
name: 🚀
uses: ./.github/workflows/bd-fe.yml
secrets:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
PUBLIC_API_URL: ${{ secrets.PUBLIC_API_URL }}
PUBLIC_API_PATH_NAVIGATION: ${{ secrets.PUBLIC_API_PATH_NAVIGATION }}
PUBLIC_API_PATH_HOME: ${{ secrets.PUBLIC_API_PATH_HOME }}
PUBLIC_API_PATH_FOOTER: ${{ secrets.PUBLIC_API_PATH_FOOTER }}
PUBLIC_API_PATH_PRIVACY: ${{ secrets.PUBLIC_API_PATH_PRIVACY }}
PUBLIC_API_PATH_POSTS_PAGE: ${{ secrets.PUBLIC_API_PATH_POSTS_PAGE }}
PUBLIC_API_PATH_POSTS: ${{ secrets.PUBLIC_API_PATH_POSTS }}
PUBLIC_POSTS_PREVIEW_PARAMS: ${{ secrets.PUBLIC_POSTS_PREVIEW_PARAMS }}
PUBLIC_API_PATH_POST: ${{ secrets.PUBLIC_API_PATH_POST }}
PUBLIC_POST_PARAMS: ${{ secrets.PUBLIC_POST_PARAMS }}
PUBLIC_API_PATH_CATEGORY: ${{ secrets.PUBLIC_API_PATH_CATEGORY }}
PUBLIC_CATEGORY_PAGE_PARAMS: ${{ secrets.PUBLIC_CATEGORY_PAGE_PARAMS }}
API_KEY: ${{ secrets.API_KEY }}
PUBLIC_SENTRY_DSN: ${{ secrets.PUBLIC_SENTRY_DSN }}
PUBLIC_ENV: ${{ secrets.PUBLIC_ENV }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
DISTRIBUTION: ${{ secrets.DISTRIBUTION }}
GH_WORKFLOW_TOKEN: ${{ secrets.GH_WORKFLOW_TOKEN }}
backstop:
name: 👀
needs: build_deploy
uses: ./.github/workflows/test-backstop.yml
secrets:
GH_WORKFLOW_TOKEN: ${{ secrets.GH_WORKFLOW_TOKEN }}
AWS_S3_BUCKET_REPORTS: ${{ secrets.AWS_S3_BUCKET_REPORTS }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
REPORTS_DISTRIBUTION: ${{ secrets.REPORTS_DISTRIBUTION }}
lighthouse:
name: 🕯️
needs: build_deploy
uses: ./.github/workflows/test-lighthouse.yml
secrets:
AWS_S3_BUCKET_REPORTS: ${{ secrets.AWS_S3_BUCKET_REPORTS }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
REPORTS_DISTRIBUTION: ${{ secrets.REPORTS_DISTRIBUTION }}
GH_WORKFLOW_TOKEN: ${{ secrets.GH_WORKFLOW_TOKEN }}
pagespeed:
name: 📈
needs: build_deploy
uses: ./.github/workflows/test-psi.yml
secrets:
PSI_APIKEY: ${{ secrets.PSI_APIKEY }}
GH_WORKFLOW_TOKEN: ${{ secrets.GH_WORKFLOW_TOKEN }}
cleanup:
name: 🧹 Cleanup
needs: [build_deploy, backstop, lighthouse, pagespeed]
runs-on: ubuntu-latest
concurrency:
group: build-deploy
cancel-in-progress: true
steps:
- name: Delete Previous deployments
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_WORKFLOW_TOKEN }}
script: |
const deployments = await github.rest.repos.listDeployments({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha
});
await Promise.all(
deployments.data.map(async (deployment) => {
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: deployment.id,
state: 'inactive'
});
return github.rest.repos.deleteDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: deployment.id
});
})
);