Merge pull request #74 from le2sky/develop #6
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: Mealkitary main CD | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
cd: | |
runs-on: ubuntu-latest | |
steps: | |
- id: check_pr_labels | |
name: PR ๋ผ๋ฒจ ํ์ธ | |
shell: bash | |
run: | | |
pull_request_labels=$(curl \ | |
--fail \ | |
-H "Accept: application/vnd.github.groot-preview+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
"${{ github.api_url }}/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" \ | |
| jq -r ".[0].labels[].name") | |
if echo "$pull_request_labels" | grep -q '^no-deployment$' ; then | |
echo "::set-output name=DEPLOYMENT::false" | |
fi | |
- uses: actions/checkout@v3 | |
- name: Firebase ์ํฌ๋ฆฟ ์์ฑ | |
run: | | |
echo ${{ secrets.ENCODED_FIREBASE_JSON }} | base64 -d > ./mealkitary-infrastructure/adapter-firebase-notification/src/main/resources/firebase.json | |
- name: JDK 11 ๊ตฌ์ฑ | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: 'gradle' | |
- name: Gradlew wrapper ์คํ ๊ถํ ๋ถ์ฌ | |
run: chmod +x gradlew | |
- name: Gradle ์บ์ฑ | |
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: Gradle ๋น๋ | |
if: ${{ steps.check_pr_labels.outputs.DEPLOYMENT != 'false' }} | |
run: ./gradlew clean build | |
- name: Docker ๋ก๊ทธ์ธ | |
if: ${{ steps.check_pr_labels.outputs.DEPLOYMENT != 'false' }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: ๋์ปค ์ด๋ฏธ์ง ๋น๋, ๋ ์ง์คํธ๋ฆฌ ์ ์ก | |
if: ${{ steps.check_pr_labels.outputs.DEPLOYMENT != 'false' }} | |
run: ./gradlew jib |