CI #114
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 : jujuAssembly | |
run-name: CI | |
on: | |
push: | |
branches: [ "dev" ] | |
jobs: | |
build-with-gradle: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
# 환경별 yml 파일 생성 - application-properties.yml | |
- name: make application.properties | |
if: | | |
contains(github.ref, 'dev') || contains(github.ref, 'main') | |
run: | | |
cd ./src/main/resources # resources 폴더로 이동 | |
touch ./application.properties # application.properties 생성 | |
echo "${{ secrets.APP_PROPERTIES }}" > ./application.properties | |
shell: bash | |
- name: make application-dev.properties | |
if: | | |
contains(github.ref, 'dev') || contains(github.ref, 'main') | |
run: | | |
cd ./src/main/resources # resources 폴더로 이동 | |
touch ./application-dev.properties # application-dev.properties 생성 | |
echo "${{ secrets.APP_DEV_PROPERTIES }}" > ./application-dev.properties | |
shell: bash | |
- name: make application-test.properties | |
if: | | |
contains(github.ref, 'dev') || contains(github.ref, 'main') | |
run: | | |
cd ./src/main/resources # resources 폴더로 이동 | |
touch ./application-test.properties # application-test.properties 생성 | |
echo "${{ secrets.APP_TEST_PROPERTIES }}" > ./application-test.properties | |
shell: bash | |
- name: Grant execute permission to gradlew | |
run: chmod +x ./gradlew | |
- name: cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build Project | |
run: ./gradlew build | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push to DockerHub | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ secrets.DOCKERHUB_TAG }} |