Skip to content

Merge branch 'master' of https://github.com/Joanne19-drive/secondGene… #50

Merge branch 'master' of https://github.com/Joanne19-drive/secondGene…

Merge branch 'master' of https://github.com/Joanne19-drive/secondGene… #50

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: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'zulu'
- name: make application.properties
run: |
# create application.properties
cd ./src/main
mkdir resources
cd ./resources
# application.yml 파일 설정
touch ./application.properties
# Secrets to application.properties
echo "${{ secrets.APPLICATION_SETTINGS }}" >> ./application.properties
shell: bash
- name: build project
run: |
./gradlew build -x test
- name: docker login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: web docker build and push
run: |
docker build --build-arg DEPENDENCY=build/dependency -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} .
docker push ${{ secrets.DOCKER_USERNAME}}/${{ secrets.DOCKER_REPO }}
shell: bash
- name: executing remote ssh commands using passowrd
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.KEY }}
port: 22
script: |
sudo docker stop subway-bot
sudo docker rm subway-bot
sudo docker image rm ${{ secrets.DOCKER_REPO }}
sudo docker pull ${{ secrets.DOCKER_USERNAME}}/${{ secrets.DOCKER_REPO }}
sudo docker run -d -p 80:8080 --name subway-bot ${{ secrets.DOCKER_USERNAME}}/${{ secrets.DOCKER_REPO }}