Skip to content

Commit bc6941b

Browse files
authored
chore(cd): 도커와 함께 빌드 되도록 수정
1 parent 6adcd2c commit bc6941b

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy to EC2
1+
name: CD
22

33
on:
44
push:
@@ -22,38 +22,28 @@ jobs:
2222
- name: Grant execute permission to gradlew
2323
run: chmod +x ./gradlew
2424

25-
- name: Build JAR without tests
25+
- name: Build JAR
2626
run: ./gradlew clean build -x test
2727

28-
- name: Rename JAR to fixed name for deployment
29-
run: |
30-
JAR_PATH=$(find build/libs -name "*.jar" | grep -v "plain" | head -n 1)
31-
echo "✅ Found JAR: $JAR_PATH"
32-
if [ "$JAR_PATH" != "build/libs/snack-0.0.1-SNAPSHOT.jar" ]; then
33-
cp "$JAR_PATH" build/libs/snack-0.0.1-SNAPSHOT.jar
34-
else
35-
echo "⚠️ JAR already has correct name. Skipping rename."
36-
fi
37-
38-
- name: Upload JAR to EC2 (overwrite)
28+
- name: Upload project to EC2
3929
uses: appleboy/scp-action@v0.1.7
4030
with:
4131
host: ${{ secrets.EC2_HOST }}
4232
username: ${{ secrets.EC2_USERNAME }}
4333
key: ${{ secrets.SSH_PRIVATE_KEY }}
4434
port: 22
45-
source: build/libs/snack-0.0.1-SNAPSHOT.jar
46-
target: /home/ubuntu/Back-end/build/libs/
35+
source: ./
36+
target: /home/ubuntu/Back-end
4737

48-
- name: Restart Spring Boot service on EC2
38+
- name: Restart snack.service on EC2
4939
uses: appleboy/ssh-action@v1.0.0
5040
with:
5141
host: ${{ secrets.EC2_HOST }}
5242
username: ${{ secrets.EC2_USERNAME }}
5343
key: ${{ secrets.SSH_PRIVATE_KEY }}
5444
port: 22
5545
script: |
56-
echo "🚀 Restarting snack.service"
46+
echo "🔄 Restarting snack.service"
5747
sudo systemctl daemon-reexec
5848
sudo systemctl restart snack.service
5949
sudo systemctl status snack.service --no-pager

0 commit comments

Comments
 (0)