Skip to content

feat: nginx.conf gitignore에 추가 #7

feat: nginx.conf gitignore에 추가

feat: nginx.conf gitignore에 추가 #7

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: CI/CD
on:
push:
branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# GitHub Secrets로부터 logback.xml 파일 생성
# - name: Create logback.xml
# run: |
# cd ./src/main/resources
# echo "${{ secrets.LOGBACK_CONFIG }}" > logback.xml
# shell: bash
# Github secrets로부터 데이터를 받아서, 워크 플로우에 파일을 생성
- name: Make application.yaml
run: |
cd ./src/main/resources
touch ./application.yaml
echo "${{ secrets.PROPERTIES }}" > ./application.yaml
shell: bash
- name: Make prometheus.yaml
run: |
cd ./src/main/resources
touch ./prometheus.yaml
echo "${{ secrets.PROMETHEUS }}" > ./prometheus.yaml
shell: bash
- name: Make application-openApi.yaml
run: |
cd ./src/main/resources
touch ./application-openApi.yaml
echo "${{ secrets.OPENAPI }}" > ./application-openApi.yaml
shell: bash
- name: Make application-jwt.yaml
run: |
cd ./src/main/resources
touch ./application-jwt.yaml
echo "${{ secrets.JWT }}" > ./application-jwt.yaml
shell: bash
- name: Make application-oauth.yaml
run: |
cd ./src/main/resources
touch ./application-oauth.yaml
echo "${{ secrets.OAUTH }}" > ./application-oauth.yaml
shell: bash
- name: Make fcm-private-key.json
run: |
cd ./src/main/resources
touch ./fcm-private-key.json
echo "${{ secrets.FCM }}" | base64 -d > ./fcm-private-key.json
shell: bash
- name: Build with Gradle Wrapper
run: |
chmod +x gradlew
./gradlew build
## 도커허브 로그인
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
## 웹 이미지 빌드 및 도커허브에 push
- name: web docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest
## docker compose up
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{secrets.USERNAME}}
key: ${{ secrets.KEY }}
script: |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}
cd ~
sudo bash deploy.sh
sudo docker image prune -f