-
Notifications
You must be signed in to change notification settings - Fork 4
72 lines (56 loc) Β· 2.17 KB
/
deploy.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
name: Deploy to GCP
on:
push:
branches:
- Master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'adopt'
- name: Configure Production Properties
run: |
touch ./src/main/resources/application-prod.properties
echo "${{ secrets.APPLICATION_PROD_PROPERTIES }}" > ./src/main/resources/application-prod.properties
- name: Configure GCS Properties
run: |
touch ./src/main/resources/application-gcs.properties
echo "${{ secrets.APPLICATION_GCS_PROPERTIES }}" > ./src/main/resources/application-gcs.properties
- name: Configure Test Properties
run: |
touch ./src/main/resources/application-test.properties
echo "${{ secrets.APPLICATION_TEST_PROPERTIES }}" > ./src/main/resources/application-test.properties
- name: gradlewμ μ€ν κΆν λΆμ¬
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build -x test
- name: Upload JAR file
uses: actions/upload-artifact@v3
with:
name: team18-be-jar
path: build/libs/team18-be-0.0.1-SNAPSHOT.jar
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download JAR file
uses: actions/download-artifact@v3
with:
name: team18-be-jar
- name: Deploy to GCP
run: |
# νμν ν¨ν€μ§ μ€μΉ
sudo apt-get install -y google-cloud-sdk
# GCP μΈμ¦
echo "${{ secrets.HIREHIGHER_GCP_SSH_KEY }}" > ${HOME}/gcp-key.json
gcloud auth activate-service-account --key-file=${HOME}/gcp-key.json
# GCP VM μΈμ€ν΄μ€μ JAR νμΌ μ μ‘
gcloud compute scp ./build/libs/team18-be-0.0.1-SNAPSHOT.jar hirehigher-api:/home/hirehigher/repository --zone asia-northeast3-a
# GCP VMμμ λ°°ν¬ μ μ€ν¬λ¦½νΈ μ€ν
gcloud compute ssh hirehigher-api --zone asia-northeast3-a --command 'bash /home/hirehigher/repository/deploy.sh'