Merge pull request #134 from softeerbootcamp4th/__hotfix #121
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
# This file was auto-generated by the Firebase CLI | |
# https://github.com/firebase/firebase-tools | |
name: Deploy Service to Firebase Hosting on merge | |
'on': | |
push: | |
branches: | |
- main | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
environment: service-production | |
defaults: | |
run: | |
working-directory: packages/service | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Make Last Hash | |
id: last | |
run: | | |
LAST_HASH=$(git rev-parse HEAD~:packages/service) | |
echo "::set-output name=hash::$LAST_HASH" | |
- 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: Create .env file | |
if: ${{steps.diff-check.outputs.diff == 'true'}} | |
run: | | |
jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' <<< "$VARS_CONTEXT" > .env | |
env: | |
VARS_CONTEXT: ${{ toJson(vars) }} | |
- name: Install Dependencies and Build | |
if: ${{steps.diff-check.outputs.diff == 'true'}} | |
run: | | |
npm install -g pnpm && pnpm install && pnpm build | |
- name: Deploy to Firebase Hosting | |
if: ${{steps.diff-check.outputs.diff == 'true'}} | |
uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
target: service | |
repoToken: '${{ secrets.GITHUB_TOKEN }}' | |
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_WATERMELON_CLAP }}' | |
projectId: watermelon-clap | |
channelId: live |