-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (47 loc) · 1.25 KB
/
cicd.yml
File metadata and controls
56 lines (47 loc) · 1.25 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
name: githubaction-cd
on:
push:
branches: [ "master" ]
jobs:
ci :
name : gitaction-test
runs-on : ubuntu-latest
steps :
- name : checkout
uses : actions/checkout@v3
- name : test
uses : actions/setup-node@v3
with :
node-version : 18.x
cache : "yarn"
- name : yarn install
run : yarn install
- name: create .env file
run: |
touch .env
cat << EOF >> .env
${{ secrets.ENV }}
- name : yarn test
run : yarn test
cd:
needs: ci
name : gitaction-cd
runs-on: ubuntu-latest
steps:
- name : checkout
uses: actions/checkout@v3
- id : "auth"
name : Authenticate to GCP
uses : google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name : server-on
run : |-
gcloud compute ssh --project=${{ secrets.GCP_PROJECT_ID }} --zone=${{ secrets.GCP_ZONE }} ${{ secrets.GCP_VM_NAME }}@${{ secrets.GCP_VM_NAME2 }} -- \
"cd github-action && \
docker-compose stop && \
docker system prune -a && \
git pull && \
docker-compose -f docker-compose.prod.yaml build && \
docker-compose -f docker-compose.prod.yaml up -d
"