Skip to content

update3

update3 #13

Workflow file for this run

name: Deploy to release Server
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
deploy:
name: Build and Push to Oracle Cloud
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: set credentials in application.yaml
uses: microsoft/variable-substitution@v1
with:
files: './src/main/resources/application.yaml'
env:
spring.profiles.active: release
- name: set credentials in application-release.yaml
uses: microsoft/variable-substitution@v1
with:
files: './src/main/resources/application-release.yaml'
env:
spring.datasource.url: ${{ secrets.MYSQL_DATASOURCE_URL }}
spring.datasource.username: ${{ secrets.MYSQL_DATASOURCE_USERNAME }}
spring.datasource.password: ${{ secrets.MYSQL_DATASOURCE_PASSWORD }}
spring.data.redis.host: ${{ secrets.REDIS_DATASOURCE_HOST }}
spring.data.redis.port: ${{ secrets.REDIS_DATASOURCE_PORT }}
cookie.encode: ${{ secrets.SECRET_KEY }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Deploy via SCP
uses: appleboy/[email protected]
with:
host: ${{ secrets.ORACLE_SERVER_HOST }}
username: ${{ secrets.ORACLE_SERVER_USERNAME }}
key: ${{ secrets.ORACLE_SERVER_SSH_KEY }}
source: './build/libs/*'
target: ~/project/areyouhere-server/build/libs
rm: true
- name: Deploy to Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.ORACLE_SERVER_HOST }}
username: ${{ secrets.ORACLE_SERVER_USERNAME }}
key: ${{ secrets.ORACLE_SERVER_SSH_KEY }}
script: |
cd ~/project/areyouhere-server/build/libs
sudo lsof -ti:8080 | sudo xargs kill -9 || true
nohup sudo java -jar ~/project/areyouhere-server/build/libs/are-you-here.jar > output.log &