refactor: 클라이언트에서 Bearer 처리하므로 공백으로 수정 #131
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
# github repository Actions 페이지에 나타낼 이름 | |
name: CI/CD | |
# event trigger | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'develop' | |
- 'release/**' | |
permissions: | |
contents: read | |
jobs: | |
CI-CD: | |
runs-on: ubuntu-latest | |
steps: | |
## jdk setting | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' # https://github.com/actions/setup-java | |
## gradle caching | |
- name: Gradle Caching | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
## create application-database.properties | |
- name: make application-database.yml | |
if: contains(github.ref, 'main') | |
run: | | |
cd ./src/main/resources | |
touch ./application-database.yml | |
echo "${{ secrets.DATABASE }}" > ./application-database.yml | |
shell: bash | |
## create application-dev.properties | |
- name: make application-dev-database.yml | |
if: contains(github.ref, 'develop') | |
run: | | |
cd ./src/main/resources | |
touch ./application-dev.yml | |
echo "${{ secrets.DATABASE_DEV }}" > ./application-dev.yml | |
shell: bash | |
## permission change | |
- name: Change gradlew permissions | |
run: chmod +x ./gradlew | |
## gradle build | |
- name: Build with Gradle | |
run: ./gradlew bootJar | |
## docker build & push to production | |
- name: Docker build & push to prod | |
if: contains(github.ref, 'main') | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -f Dockerfile -t ${{ secrets.DOCKER_REPO }}/hibit2 . | |
docker push ${{ secrets.DOCKER_REPO }}/hibit2 | |
## docker build & push to develop | |
- name: Docker build & push to dev | |
if: contains(github.ref, 'develop') | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -f Dockerfile -t ${{ secrets.DOCKER_REPO }}/hibitdev . | |
docker push ${{ secrets.DOCKER_REPO }}/hibitdev | |
## deploy to production | |
- name: Deploy to prod | |
uses: appleboy/ssh-action@master | |
id: deploy-prod | |
if: contains(github.ref, 'main') | |
with: | |
host: ${{ secrets.HOST}} | |
username: ubuntu | |
envs: GITHUB_SHA | |
key: ${{ secrets.KEY }} | |
script: | | |
sudo docker rm -f $(docker ps -qa) | |
sudo docker pull ${{ secrets.DOCKER_REPO }}/hibit2 | |
docker-compose up -d | |
docker image prune -f | |
## deploy to develop | |
- name: Deploy to dev | |
uses: appleboy/ssh-action@master | |
id: deploy-dev | |
if: contains(github.ref, 'develop') | |
with: | |
host: ${{ secrets.HOST_DEV }} | |
username: ubuntu | |
envs: GITHUB_SHA | |
key: ${{ secrets.KEY_DEV }} | |
script: | | |
sudo docker rm -f $(docker ps -qa) | |
sudo docker pull ${{ secrets.DOCKER_REPO }}/hibitdev | |
docker-compose up -d | |
docker image prune -f |