Skip to content

Commit

Permalink
Implemented autodeploy flow for uat
Browse files Browse the repository at this point in the history
  • Loading branch information
adityasharma7 committed Nov 23, 2022
1 parent 94166ca commit 2f4c3e5
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 7 deletions.
13 changes: 11 additions & 2 deletions .firebaserc
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,24 @@
"targets": {
"hotwax-digital-commerce": {
"hosting": {
"bopis-dev": [
"dev": [
"bopis-dev"
],
"uat": [
"bopis-uat"
]
}
},
"digital-commerce-71eb8": {
"hosting": {
"hotwax-bopis": [
"prod": [
"hotwax-bopis"
],
"prod-v1": [
"hotwax-bopis"
],
"prod-v2": [
"hotwax-bopis-v2"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
env:
HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }}
- name: Deploy
run: firebase deploy --token "$HOTWAX_PUBLIC_SECRET" -m "Deploying via GitHub actions" --only hosting:bopis-dev
run: firebase deploy --token "$HOTWAX_PUBLIC_SECRET" -m "Deploying via GitHub actions" --only hosting:dev
env:
HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }}
32 changes: 32 additions & 0 deletions .github/workflows/firebase-hosting-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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
- 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 }}
45 changes: 41 additions & 4 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"hosting": [
{
"target": "hotwax-bopis",
"target": "prod",
"public": "dist",
"ignore": [
"firebase.json",
Expand All @@ -12,10 +12,48 @@
"source": "**",
"destination": "/index.html"
} ]

},
{
"target": "bopis-dev",
"target": "prod-v1",
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "**",
"destination": "/index.html"
} ]
},
{
"target": "prod-v2",
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "**",
"destination": "/index.html"
} ]
},
{
"target": "dev",
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "**",
"destination": "/index.html"
} ]
},
{
"target": "uat",
"public": "dist",
"ignore": [
"firebase.json",
Expand All @@ -26,7 +64,6 @@
"source": "**",
"destination": "/index.html"
} ]

}
]
}

0 comments on commit 2f4c3e5

Please sign in to comment.