-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (98 loc) · 3.1 KB
/
deploy.yaml
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
name: Deploy
on: [push]
jobs:
Build:
runs-on: ubuntu-latest
name: Build
steps:
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup Chrome
uses: browser-actions/setup-chrome@latest
- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@9.5
with:
cli: 1.11.1.1182
- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
key: cljdeps-${{ hashFiles('shadow-cljs.edn') }}
restore-keys: cljdeps-
- name: npm cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install node dependencies
run: npm ci
- name: Test
run: npm run ci
- name: Build
run: |
npm run release
- uses: actions/upload-artifact@v3
with:
name: build-artefact
path: ./resources/public/
retention-days: 1
DeployStaging:
runs-on: ubuntu-latest
name: Deploy to Staging
needs: [Build]
environment:
name: Staging
url: 'https://staging.deepumohan.com/games/2048'
steps:
- uses: actions/download-artifact@v3
with:
name: build-artefact
path: ~/artefact/
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: eu-west-1
role-duration-seconds: 900
role-session-name: publish-to-s3-action
- name: Copy files to the test website with the AWS CLI
run: |
aws s3 sync ~/artefact/ s3://staging.deepumohan.com/games/2048/
DeployProd:
runs-on: ubuntu-latest
name: Deploy to Production
if: github.event.ref == 'refs/heads/main'
needs: [DeployStaging]
environment:
name: Production
url: 'https://deepumohan.com/games/2048'
steps:
- uses: actions/download-artifact@v3
with:
name: build-artefact
path: ~/artefact/
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: eu-west-1
role-duration-seconds: 900
role-session-name: publish-to-s3-action
- name: Copy files to the test website with the AWS CLI
run: |
aws s3 sync ~/artefact/ s3://deepumohan.com/games/2048/