From af042116208b3573bf5908deab256fd566b6fb6b Mon Sep 17 00:00:00 2001 From: Sanskar Soni Date: Thu, 13 Jul 2023 16:16:53 +0530 Subject: [PATCH] Implemented: updated actions to common workflow --- .github/workflows/firebase-hosting-merge.yml | 30 ++++------------ .../workflows/firebase-hosting-release.yml | 36 ++++++------------- .github/workflows/pull-request.yml | 35 +++++------------- 3 files changed, 26 insertions(+), 75 deletions(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 1704e086..6cf9fc9e 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -7,26 +7,10 @@ name: Deploy to Firebase Hosting on merge branches: - main jobs: - build_and_deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: Install Dependencies - run: npm install - - name: Generate .env file - run: cp .env.example .env - - name: Build - run: npm run build - - name: Install Firebase - run: npm install -g firebase-tools - - name: Set Firebase project - run: firebase use default --token "$HOTWAX_PUBLIC_SECRET" - env: - HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }} - - name: Deploy - run: firebase deploy --token "$HOTWAX_PUBLIC_SECRET" -m "Deploying via GitHub actions" --only hosting:dev - env: - HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }} + call-workflow-in-another-repo: + uses: hotwax/dxp-components/.github/workflows/common-firebase-hosting-merge.yml@main + with: + config-path: .github/labeler.yml + secrets: + envPAT: ${{ secrets.envPAT }} + HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }} \ No newline at end of file diff --git a/.github/workflows/firebase-hosting-release.yml b/.github/workflows/firebase-hosting-release.yml index 5a164407..95f9c36e 100644 --- a/.github/workflows/firebase-hosting-release.yml +++ b/.github/workflows/firebase-hosting-release.yml @@ -1,32 +1,16 @@ +# This file was auto-generated by the Firebase CLI +# https://github.com/firebase/firebase-tools + name: Deploy to Firebase Hosting on release 'on': push: tags: - '*' # Push events to every tag not containing / Refer https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#patterns-to-match-branches-and-tags jobs: - build_and_deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: Checkout to latest release tag - run: | - git checkout $(git describe --tags `git rev-list --tags --max-count=1`) - - name: Install Dependencies - run: npm install - - name: Generate .env file - run: cp .env.example .env - - name: Build - run: npm run build - - name: Install Firebase - run: npm install -g firebase-tools - - name: Set Firebase project - run: firebase use default --token "$HOTWAX_PUBLIC_SECRET" - env: - HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }} - - name: Deploy - run: firebase deploy --token "$HOTWAX_PUBLIC_SECRET" -m "Deploying via GitHub actions" --only hosting:uat - env: - HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }} \ No newline at end of file + call-workflow-in-another-repo: + uses: hotwax/dxp-components/.github/workflows/common-firebase-hosting-release.yml@main + with: + config-path: .github/labeler.yml + secrets: + envPAT: ${{ secrets.envPAT }} + HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }} \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 459fd7b7..0dc36964 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -2,32 +2,15 @@ name: Verify build on: push: - branches: [ main ] + branches: [main] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] - + branches: [main] -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [12.x, 14.x, 16.x] - - steps: - - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - - name: Install Dependencies - run: npm install - - name: Generate .env file - run: cp .env.example .env - - name: Build - run: npm run build +jobs: + call-workflow-in-another-repo: + uses: hotwax/dxp-components/.github/workflows/common-pull-request.yml@main + with: + config-path: .github/labeler.yml + secrets: + envPAT: ${{ secrets.envPAT }}