Skip to content

feat: start and get game API #115 (#134) #63

feat: start and get game API #115 (#134)

feat: start and get game API #115 (#134) #63

name: Java CD
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
working-directory: packages/backend/
run: mvn package -DskipTests
- name: Move JAR and Dockerfile to workspace
run: |
mv packages/backend/spring/target/citadels-backend-0.0.1-SNAPSHOT.jar $GITHUB_WORKSPACE/citadels-backend-0.0.1-SNAPSHOT.jar
mv packages/backend/spring/Dockerfile $GITHUB_WORKSPACE/Dockerfile
mv packages/backend/spring/docker-compose.yml $GITHUB_WORKSPACE/docker-compose.yml
rm -rf packages docs README.md
- name: Deploy to Server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.HOST }}
REMOTE_USER: ${{ secrets.USERNAME }}
TARGET: ${{ secrets.TARGET_DIR }}/backend
- name: Executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
port: ${{ secrets.PORT }}
script: |
cd ~/citadels/backend
sudo MONGO_URI=$MONGO_URI docker-compose up -d --build