From ade31b670fc55fbe6f69e1e5a68485eb0f54f122 Mon Sep 17 00:00:00 2001 From: dntjd1097 Date: Fri, 17 May 2024 18:49:55 +0900 Subject: [PATCH] host : firebase --- .github/workflows/gdsc-dju-deploy-live.yml | 84 +++++++++++++++++++ .github/workflows/gdsc-dju-deploy-preview.yml | 8 +- 2 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/gdsc-dju-deploy-live.yml diff --git a/.github/workflows/gdsc-dju-deploy-live.yml b/.github/workflows/gdsc-dju-deploy-live.yml new file mode 100644 index 0000000..1094dda --- /dev/null +++ b/.github/workflows/gdsc-dju-deploy-live.yml @@ -0,0 +1,84 @@ +name: Deploy to GDSC DJU Preview Channel + +on: + push: + branches: + - master + pull_request: + branches: + - master + types: + - closed + paths: + - '.github/workflows/gdsc-dju-deploy-preview.yml' +jobs: + Deploy_preview_channel: + runs-on: ubuntu-latest + + environment: + name: GDSC DJU live + url: https://preview.gdscdju.dev + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: 캐시 폴더를 가져오고 있어요. + id: yarn-cache-dir-path + run: echo "dir=$(cd client && yarn config get cacheFolder)" >> $GITHUB_ENV + + - name: 캐시 의존성을 설정하고 있어요. + uses: actions/cache@v3 + with: + path: ~/.yarn + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Node 버전/캐싱여부를 설정하고 있어요. + uses: actions/setup-node@v3 + with: + node-version: 20 + cache: yarn + cache-dependency-path: ./yarn.lock + registry-url: 'https://registry.yarnpkg.com' + - name: Setting .env + run: | + echo "FIREBASE_API_KEY=${{ secrets.FIREBASE_API_KEY }}" >> .env + echo "FIREBASE_AUTH_DOMAIN=${{ secrets.FIREBASE_AUTH_DOMAIN }}" >> .env + echo "FIREBASE_DATABASE_URL=${{ secrets.FIREBASE_DATABASE_URL }}" >> .env + echo "FIREBASE_PROJECT_ID=${{ secrets.FIREBASE_PROJECT_ID }}" >> .env + echo "FIREBASE_STORAGE_BUCKET=${{ secrets.FIREBASE_STORAGE_BUCKET }}" >> .env + echo "FIREBASE_MESSAGING_SENDER_ID=${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}" >> .env + echo "FIREBASE_APPID=${{ secrets.FIREBASE_APPID }}" >> .env + echo "FIREBASE_MEASUREMENT_ID=${{ secrets.FIREBASE_MEASUREMENT_ID }}" >> .env + cat .env + - name: Project yarn install + run: yarn install + - name: Project Build + run: yarn build + - name: Get short SHA + id: slug + run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" + - uses: HyeokE/action-hosting-deploy@main + id: run_firebase_preview + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GDSC_DJU }}' + projectId: gdsc-dju + target: gdsc-dju-preview + expires: 3d + channelId: ' ${{ steps.slug.outputs.sha8 }}-${{ github.event.pull_request.head.ref }} ' + env: + FIREBASE_CLI_PREVIEWS: hostingchannels + - name: Discord Message Notify + uses: appleboy/discord-action@0.0.3 + with: + webhook_id: ${{ secrets.DISCORD_ADMIN_WEBHOOK_ID }} + webhook_token: ${{ secrets.DISCORD_ADMIN_WEBHOOK_TOKEN }} + color: '#4285f4' + args: | + gdsc-dju-admin has been deployed to Preview channel + `Contributor`: ${{github.actor}} + `Event Status` ${{github.event_name}} + `URL` <${{steps.run_firebase_preview.outputs.details_url}}> + `Build Time` ${{steps.run_firebase_preview.outputs.expire_time}} diff --git a/.github/workflows/gdsc-dju-deploy-preview.yml b/.github/workflows/gdsc-dju-deploy-preview.yml index 482eb11..56524b3 100644 --- a/.github/workflows/gdsc-dju-deploy-preview.yml +++ b/.github/workflows/gdsc-dju-deploy-preview.yml @@ -1,4 +1,4 @@ -name: Deploy to GDSC DJU Admin Preview Channel +name: Deploy to GDSC DJU Preview Channel on: push: @@ -13,8 +13,7 @@ on: jobs: Deploy_preview_channel: runs-on: ubuntu-latest - env: - working-directory: ./apps/admin(deprecated) + environment: name: GDSC DJU Preview url: ${{ steps.run_firebase_preview.outputs.details_url }} @@ -52,7 +51,6 @@ jobs: echo "FIREBASE_APPID=${{ secrets.FIREBASE_APPID }}" >> .env echo "FIREBASE_MEASUREMENT_ID=${{ secrets.FIREBASE_MEASUREMENT_ID }}" >> .env cat .env - working-directory: ${{ env.working-directory }} - name: Project yarn install run: yarn install - name: Project Build @@ -60,7 +58,6 @@ jobs: - name: Get short SHA id: slug run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" - working-directory: ${{ env.working-directory }} - uses: HyeokE/action-hosting-deploy@main id: run_firebase_preview with: @@ -70,7 +67,6 @@ jobs: target: gdsc-dju-preview expires: 3d channelId: ' ${{ steps.slug.outputs.sha8 }}-${{ github.event.pull_request.head.ref }} ' - entryPoint: ${{ env.working-directory }} env: FIREBASE_CLI_PREVIEWS: hostingchannels - name: Discord Message Notify