fix: initialize mysql password #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: [ "dev", "feat/LINKER-11" ] | |
pull_request: | |
branches: [ "dev", "feat/LINKER-11" ] | |
permissions: | |
contents: read | |
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' | |
- name: make .env | |
run: | | |
touch ./.env | |
echo "${{ secrets.ENV }}" > ./.env | |
- name: NCP transfer | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.NCP_USERNAME }} | |
password: ${{ secrets.NCP_PASSWORD }} | |
port: ${{ secrets.NCP_PORT }} | |
source: ${{ secrets.SOURCE_PATH }} | |
target: ${{ secrets.DIST_PATH }} | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew build -x test | |
- name: Docker build | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -t app . | |
docker tag app ${{ secrets.DOCKER_USERNAME }}/linker:latest | |
docker push ${{ secrets.DOCKER_USERNAME }}/linker:latest | |
- name: Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} # NCP 서버접속용 공인 IP | |
username: ${{ secrets.NCP_USERNAME }} | |
password: ${{ secrets.NCP_PASSWORD }} | |
port: ${{ secrets.NCP_PORT }} # port | |
# 도커 작업 | |
script: | | |
cd /home/linker | |
docker-compose -f docker-compose.dev.yml down | |
docker pull ${{ secrets.DOCKER_USERNAME }}/linker:latest | |
docker-compose -f docker-compose.dev.yml up -d | |
docker rm $(docker ps --filter 'status=exited' -a -q) | |
docker image prune -a -f |