🔧 브랜치 제한 일시적 해제 #28
Workflow file for this run
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
name: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- "develop" | |
- "main" | |
- "infra/https-config" | |
pull_request: | |
branches: | |
- "develop" | |
- "main" | |
permissions: read-all | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- 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- | |
- name: Make 'application.yml' | |
run: | | |
cd ./src/main/resources | |
touch ./application.yml | |
echo "${{ secrets.APPLICATION_YML_DEV }}" | base64 --decode > ./application.yml | |
cat ./application.yml | |
shell: bash | |
- name: Make 'application.yml' | |
if: contains(github.ref, 'main') | |
run: | | |
cd ./src/main/resources | |
touch ./application.yml | |
echo "${{ secrets.APPLICATION_YML }}" | base64 --decode > ./application.yml | |
cat ./application.yml | |
shell: bash | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew bootJar | |
- name: Build Docker Image with Gradle | |
run: | | |
docker login -u ${{ secrets.DOCKER_ID }} -p ${{ secrets.DOCKER_PASSWORD }} | |
./gradlew bootBuildImage | |
- name: Containerize Docker Image / Start Spring Boot Application | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USER }} | |
key: ${{ secrets.EC2_KEY }} | |
script: | | |
docker rm -f $(docker ps -qa) | |
docker rmi ${{ secrets.DOCKER_USERNAME }}/dailysteady | |
docker pull ${{ secrets.DOCKER_USERNAME }}/dailysteady | |
docker-compose up -d |