Skip to content

Commit 157199d

Browse files
committed
[FIX]: secret cicd
1 parent 60e37ff commit 157199d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.github/workflows/cd.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
username: ${{ secrets.EC2_USER }}
2323
key: ${{ secrets.EC2_SSH_KEY }}
2424
source: application-secret.yml
25-
target: /home/ubuntu/
25+
target: /home/ubuntu/app/config/
2626

2727
- name: Upload deploy.sh to EC2
2828
uses: appleboy/scp-action@v0.1.3
@@ -31,7 +31,7 @@ jobs:
3131
username: ${{ secrets.EC2_USER }}
3232
key: ${{ secrets.EC2_SSH_KEY }}
3333
source: ./deploy.sh
34-
target: /home/ubuntu/
34+
target: /home/ubuntu/app/
3535

3636
- name: SSH and Deploy
3737
uses: appleboy/ssh-action@v1.0.0
@@ -42,5 +42,5 @@ jobs:
4242
script: |
4343
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
4444
export DOCKERHUB_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
45-
chmod +x /home/ubuntu/deploy.sh
46-
/home/ubuntu/deploy.sh
45+
chmod +x /home/ubuntu/app/deploy.sh
46+
/home/ubuntu/app/deploy.sh

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ jobs:
1919
java-version: '17'
2020
distribution: 'temurin'
2121

22+
- name: Write application-secret.yml to runner
23+
run: |
24+
echo "${{ secrets.APPLICATION_SECRET }}" > application-secret.yml
25+
26+
- name: Move secret into resources
27+
run: |
28+
mkdir -p src/main/resources
29+
mv application-secret.yml src/main/resources/
30+
2231
- name: Grant execute permission to gradlew
2332
run: chmod +x ./gradlew
2433

0 commit comments

Comments
 (0)