Skip to content

feat: 낫투두 등록시 날짜형식 유효성 체크 추가 #87

feat: 낫투두 등록시 날짜형식 유효성 체크 추가

feat: 낫투두 등록시 날짜형식 유효성 체크 추가 #87

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- uses: actions/checkout@v3
- run: touch ./src/main/resources/application-prod.yml
- run: echo "${{ secrets.APPLICATION_PROD }}" > ./src/main/resources/application-prod.yml
- run: cat ./src/main/resources/application-prod.yml
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew clean build --exclude-task test
# - name: Build with Gradle
# uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
# with:
# arguments: build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: cicd
path: build/libs/*.jar
- name: Upload property file
uses: actions/upload-artifact@v2
with:
name: property
path: ./src/main/resources/application-prod.yml
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: cicd
- name: Download property
uses: actions/download-artifact@v2
with:
name: property
- name: Publish to GitHub Packages Gradle
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
HOST: ${{ secrets.SERVER_IP }}
USERNAME: ${{ secrets.SSH_USER }}
PORT: ${{ secrets.SERVER_PORT }}
# scp -i private_key.pem -P $PORT -o StrictHostKeyChecking=no -r target/*.jar $USERNAME@$HOST:/home/$USERNAME/
#nohup java -jar /home/$USERNAME/*.jar > /dev/null 2>&1 & disown
run: |
echo "$PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
scp -i private_key.pem -P $PORT -o StrictHostKeyChecking=no -r application-prod.yml $USERNAME@$HOST:/home/appuser
scp -i private_key.pem -P $PORT -o StrictHostKeyChecking=no -r *.jar $USERNAME@$HOST:/home/appuser/jars/
ssh -i private_key.pem -p $PORT -o StrictHostKeyChecking=no $USERNAME@$HOST 'bash -s' <<- EOF
pgrep java | xargs kill -9 || true
nohup java -jar /home/appuser/jars/*SNAPSHOT.jar > application.log 2>&1 &
exit
EOF
rm -f private_key.pem