Skip to content

Commit

Permalink
Merge pull request #11 from softeerbootcamp4th/build/CLAP-51
Browse files Browse the repository at this point in the history
build(CLAP-51): github merge 액션 개선하기
  • Loading branch information
bluejoyq authored Jul 24, 2024
2 parents 36239a4 + 5f2f411 commit 02a3c90
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 22 deletions.
31 changes: 24 additions & 7 deletions .github/workflows/fb-hosting-service-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,39 @@ jobs:
working-directory: packages/service
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
with:
RELATIVE: '/'
id: git-diff
- 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.git-diff.outputs.diff
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.git-diff.outputs.diff
if: steps.diff-check.outputs.diff
run: |
npm install -g pnpm && pnpm install && pnpm build
- name: Deploy to Firebase Hosting
if: steps.git-diff.outputs.diff
if: steps.diff-check.outputs.diff
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
Expand Down
49 changes: 35 additions & 14 deletions .github/workflows/fb-hosting-service-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,57 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy Service to Firebase Hosting on PR
'on': pull_request
on: pull_request
jobs:


build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
environment: preview
defaults:
run:
working-directory: packages/service
steps:
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v6
with:
RELATIVE: 'packages/service'
id: git-diff
fetch-depth: 0

- run: git branch -a
- name: Make Last Hash
id: last
run: |
LAST_HASH=$(git rev-parse remotes/origin/main: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.git-diff.outputs.diff
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.git-diff.outputs.diff
if: ${{ steps.diff-check.outputs.diff }}
run: |
npm install -g pnpm && pnpm install && pnpm build
- name: Deploy to Firebase Hosting
if: steps.git-diff.outputs.diff
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
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_WATERMELON_CLAP }}
projectId: watermelon-clap
2 changes: 1 addition & 1 deletion packages/service/src/Main/pages/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const MainPage = () => {
right: 20px;
`}
>
개발
개발ㄴ
</Link>
</div>
);
Expand Down

0 comments on commit 02a3c90

Please sign in to comment.