Type: fix file path (#76) #36
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: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: make application.properties | |
run: | | |
cd ./src/main/resources | |
touch ./application.properties | |
# GitHub-Actions 에서 설정한 값을 application.properties 파일에 쓰기 | |
echo "${{ secrets.PROPERTIES }}" >> ./application.properties | |
shell: bash | |
# 환경 변수 설정 (Firebase) | |
- name: create-json | |
id: create-json | |
uses: jsdaniell/[email protected] | |
with: | |
name: ${{ secrets.FIREBASE_JSON_FILENAME }} | |
json: ${{ secrets.FIREBASE_JSON }} | |
dir: 'src/main/resources' | |
- name: Build with Gradle | |
run: | | |
chmod +x ./gradlew | |
./gradlew bootJar | |
- name: web docker build and push | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -f DockerFile -t ${{ secrets.DOCKER_REPO }}/igomoney-app . | |
docker push ${{ secrets.DOCKER_REPO }}/igomoney-app | |
# docker compose up | |
- name: executing remote ssh commands using password | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
#password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: | | |
sudo docker rm -f $(docker ps -qa) | |
sudo docker pull ${{ secrets.DOCKER_REPO }}/igomoney-app | |
docker-compose up -d | |
docker image prune -f |