Skip to content

Commit

Permalink
Implemented: updated actions to common workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sanskar345 committed Jul 13, 2023
1 parent ddba79f commit af04211
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 75 deletions.
30 changes: 7 additions & 23 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
36 changes: 10 additions & 26 deletions .github/workflows/firebase-hosting-release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
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 }}
35 changes: 9 additions & 26 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit af04211

Please sign in to comment.