Skip to content

feat: github workflow main.yml 구현 #1

feat: github workflow main.yml 구현

feat: github workflow main.yml 구현 #1

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: ${{ SECRET_KEY }}

Check failure on line 42 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / Deploy to release Server

Invalid workflow file

The workflow is not valid. .github/workflows/main.yml (Line: 42, Col: 26): Unrecognized named-value: 'SECRET_KEY'. Located at position 1 within expression: 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 }}
port: $ {{ secrets.ORACLE_SERVER_PORT }}
target: ${{ secrets.DEPLOY_TARGET }}
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 }}
port: $ {{ secrets.ORACLE_SERVER_PORT }}
script: |
cd /home/ubuntu/project/areyouhere-server
nohup sudo java -jar are-you-here.jar > output.log &
sudo lsof -ti:8080 | sudo xargs kill -9 || true