Skip to content

Add files via upload #50

Add files via upload

Add files via upload #50

Workflow file for this run

name: Java CI with Gradle
# 동작 조건 설정 : main 브랜치에 push 혹은 pull request가 발생할 경우 동작한다.
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
SSH_KEY: |
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEAu8kOHvDW0/Riv8ZAWgCpe4qtLaHuYIJfy7+7lv/kECCVAV2c6eVt
26y2BcG4RW1BDM0bJkVBMdzn7ghoWZsiTiRNXGt9TddIK+AnZ5BS4SXHFz+S4QhzPnK+CQ
ih7muVhEhnMXbG271laXWxnAQMJHoGfbZeaRAwPN3j108rsocd1IOMfYVEPx412RMgA7rt
FKgPA4f5cHfau8fEZrOIzLEzo02UrI14vBM/SSIQLbAaj4Kod7wWwlNGO1K++QI66vZHIW
Yyx987AEGWwLz5bzu3lbu0JFK2hjHvTJ39A3DJFOLndGJKKj6f/6bXHgM4hL01dVrbO8yN
rFUlHj9hiYxcTL6KHguk77sXWXrsdb5mscQ6dLXBdtwoygDYxPzHeA+9WaY3FpjxrixWF/
kUkTEDHmDv7eX+XHuLLwPKv/xx23ttBjCq9lbI7ejwULFvr6IZu9XZunG4oOjNCbe5O+lr
AzQ9NCX7VHsDUPIiJFKzWTUjhXETRcLmo7sTtAGRAAAFiI4+8LKOPvCyAAAAB3NzaC1yc2
EAAAGBALvJDh7w1tP0Yr/GQFoAqXuKrS2h7mCCX8u/u5b/5BAglQFdnOnlbdustgXBuEVt
QQzNGyZFQTHc5+4IaFmbIk4kTVxrfU3XSCvgJ2eQUuElxxc/kuEIcz5yvgkIoe5rlYRIZz
F2xtu9ZWl1sZwEDCR6Bn22XmkQMDzd49dPK7KHHdSDjH2FRD8eNdkTIAO67RSoDwOH+XB3
2rvHxGaziMyxM6NNlKyNeLwTP0kiEC2wGo+Cq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B+DffB+raNOSAFGwAAAMEA3OE7UckwIJhWXyot
+cRRrfh+e1w7iwt2rp5U/QqrxU42OCoGaAei9KYJJRCTEBCAweRmZJpzWmbEI01/SO7J75
QKUKLQph39rLMe20CCht+bzBKWM4xYV7j7Xs4PgYeh4mPOwVAUqw2LdqyDggdrWcfAbi/D
grdflhLLEbluwJfeneSo2blEy9HVo6pckXTlBa/K0yJlJcsFWlbptMyPgZtZoQ7chvsw4Q
WNnmdgPR0iQcS14Ftfn4KLx5w8M/NPAAAAwQDZpLxlExqd240Ty+7folLoiNh/hnMrh867
n4Nfojng5pLHQwpEQ1kHd8SQAth0FHdIaeEWXlZhmXBBfbWUvB6XX9tu4f+4Aa/3sAghfG
sQH0A9Umx2iKi+Z2Z626LI3MB74O5Or0GuLy6Q1duOeQAEWiL70RnS+UNl0iBdXOZb7vIL
pEUq/eXkkV+zheeF4rV5JBKayS155CkB4CUf1CYTo17LZObDjkbQgVZ4qd/uQ5cZy1N+lu
v0KD0cKVmHBR8AAAATcHN3bG92ZTM4QGdtYWlsLmNvbQ==
-----END OPENSSH PRIVATE KEY-----
permissions:
contents: read
jobs:
# Spring Boot 애플리케이션을 빌드하여 도커허브에 푸시하는 과정
build-docker-image:
runs-on: ubuntu-latest
steps:
# 기본적인 체크아웃
- name: Checkout
uses: actions/checkout@v3
# 자바 버전 설정
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
# gradlew에 실행 권한 부여
- name: Executable to /gradlew
run: chmod +x ./gradlew
# 프로젝트 빌드
- name: Project Build
run: ./gradlew clean bootwar
# 자바 Spring Boot 빌드
# - name: Build with Gradle
# uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
# with:
# arguments: clean build
# 3. Docker 이미지 빌드
- name: docker image build
run: docker build -t pswlove38/github-actions-demo .
# 4. DockerHub 로그인
- name: docker login
uses: docker/login-action@v2
with:
username: pswlove38
password: a77981010!
# 5. Docker Hub 이미지 푸시
- name: docker Hub push
run: docker push pswlove38/github-actions-demo
# 6. GCP에 SSH로 접속
- name: executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
with:
host: 35.212.196.164
username: pswlove38
key: ${{ env.SSH_KEY }}
port: 22
script: |
sudo docker rm -f $(docker ps -qa)
sudo docker pull pswlove38/github-actions-demo
sudo docker pull pswlove38/change-nginx
docker-compose up -d
docker image prune -f