Skip to content

StudentStartRow = 5 #33

StudentStartRow = 5

StudentStartRow = 5 #33

Workflow file for this run

name: testAndDeploy
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Java setup
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "adopt"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run test
run: ./gradlew test
- name: test build
run: ./gradlew build -x test
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- name: Set up SSH
run: |
mkdir -p ~/.ssh/
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Set up known hosts
run: |
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
- name: SSH and deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.KIRBY_SERVER_HOST }}
username: ${{ secrets.KIRBY_SERVER_USERNAME }}
password: ${{ secrets.KIRBY_SERVER_PASSWORD }}
port: ${{ secrets.KIRBY_SERVER_PORT }}
script: |
cd unistMeal_backend/unistMeal-backend
git pull || exit 1
docker stop unist-meal-backend || exit 1
docker container rm unist-meal-backend || exit 1
docker rmi unist-meal-backend:latest || exit 1
docker build -t unist-meal-backend:latest . || exit 1
docker run -d --name unist-meal-backend --net host -e TZ=Asia/Seoul \
-e DATABASE_URL=${{ secrets.DATABASE_URL }} \
-e DATABASE_USERNAME=${{ secrets.DATABASE_USERNAME }} \
-e DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }} \
-e SECRET_KEY=${{ secrets.SECRET_KEY }} \
unist-meal-backend:latest || exit 1
exit