Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy Spring Boot Application To API Server

on:
push:
branches: [ "dev" ]

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Set up Application Secret YML
run: |
echo "${{ secrets.APPLICATION_SECRET }}" | base64 --decode > src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_DEV }}" | base64 --decode > src/main/resources/application-secret-dev.yml
mkdir -p src/main/resources/ssl
echo "${{ secrets.KEYSTORE }}" | base64 --decode > src/main/resources/ssl/keystore.p12

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle Wrapper
run: ./gradlew build

- name: Copy JAR to server
uses: appleboy/scp-action@v1
with:
host: ${{ secrets.HOST }}
port: ${{ secrets.PORT }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
source: "build/libs/*.jar"
target: "/home/ubuntu/app/"

- name: Restart Service
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
port: ${{ secrets.PORT }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
script: |
sudo systemctl restart jobnote
Loading