diff --git a/.firebaserc b/.firebaserc index 8927c1c..b63fe78 100644 --- a/.firebaserc +++ b/.firebaserc @@ -1,6 +1,7 @@ { "projects": { "default": "hotwax-digital-commerce", + "uat": "hotwax-digital-commerce-uat", "production": "digital-commerce-71eb8" }, "targets": { @@ -8,7 +9,11 @@ "hosting": { "dev": [ "hotwax-order-routing-dev" - ], + ] + } + }, + "hotwax-digital-commerce-uat": { + "hosting": { "uat": [ "hotwax-order-routing-uat" ] diff --git a/.github/workflows/firebase-hosting-release.yml b/.github/workflows/firebase-hosting-release.yml new file mode 100644 index 0000000..b3c180b --- /dev/null +++ b/.github/workflows/firebase-hosting-release.yml @@ -0,0 +1,37 @@ +# Not using the common release workflow file from dxp, as for this app we are using a different project for hosting the uat env + +# 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: 18 + - 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 uat --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