Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 12 commits into from
Jul 24, 2024
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
Loading