Skip to content

Infra/https-config

Infra/https-config #32

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- "develop"
- "main"
- "infra/**"
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: Inject Resource Files
run: |
mkdir ./src/main/resources
shell: bash
- name: Make 'application.yml'
# if: contains(github.ref, 'main')
run: |
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.APPLICATION_YML_DEV }}" | base64 --decode > ./application.yml
shell: bash
- name: Make 'keystore.p12'
run: |
cd ./src/main/resources
touch ./keystore.p12
echo "${{ secrets.KEYSTORE }}" | base64 --decode > ./keystore.p12
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