Skip to content

build(CLAP-51): github merge 액션 개선하기 #30

build(CLAP-51): github merge 액션 개선하기

build(CLAP-51): github merge 액션 개선하기 #30

name: Deploy Service to Firebase Hosting on PR
on: pull_request
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
environment: preview
steps:
- uses: actions/checkout@v3
- name: Make Last Hash
id: last
run: |
LAST_HASH=$(git rev-parse main:packages/service)
echo "::set-output name=hash::$LAST_HASH"
- run: git branch -a
- name: Make Current Hash
id: current
run: |
CURRENT_HASH=$(git rev-parse HEAD:packages/service)
echo "::set-output name=hash::$CURRENT_HASH"
- name: Set Diff
id: diff-check
run: |
if [ "${{ steps.last.outputs.hash }}" != "${{ steps.current.outputs.hash }}" ]; then
echo "::set-output name=diff::true"
else
echo "::set-output name=diff::false"
fi
- name: package-folder
run: cd ./packages/service
- name: Create .env file
if: ${{ steps.diff-check.outputs.diff }}
run: |
jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' <<< "$SECRETS_CONTEXT" > .env
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}
- name: Install Dependencies and Build
if: ${{ steps.diff-check.outputs.diff }}
run: |
npm install -g pnpm && pnpm install && pnpm build
- name: Deploy to Firebase Hosting
if: ${{ steps.diff-check.outputs.diff }}
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WATERMELON_CLAP }}
projectId: watermelon-clap