diff --git a/.firebaserc b/.firebaserc index 69f3171e..aa358bb4 100644 --- a/.firebaserc +++ b/.firebaserc @@ -6,14 +6,17 @@ "targets": { "hotwax-digital-commerce": { "hosting": { - "dev-fulfillment": [ + "dev": [ "dev-fulfillment" + ], + "uat": [ + "uat-fulfillment" ] } }, "digital-commerce-71eb8": { "hosting": { - "hotwax-fulfillment": [ + "prod": [ "hotwax-fulfillment" ] } diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 558d99ae..2c438b95 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -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:dev-fulfillment + run: firebase deploy --token "$HOTWAX_PUBLIC_SECRET" -m "Deploying via GitHub actions" --only hosting:dev env: HOTWAX_PUBLIC_SECRET: ${{ secrets.HOTWAX_PUBLIC_SECRET }} diff --git a/.github/workflows/firebase-hosting-release.yml b/.github/workflows/firebase-hosting-release.yml new file mode 100644 index 00000000..6e6ffb58 --- /dev/null +++ b/.github/workflows/firebase-hosting-release.yml @@ -0,0 +1,29 @@ +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 }} \ No newline at end of file diff --git a/firebase.json b/firebase.json index fd67242d..0ad66623 100644 --- a/firebase.json +++ b/firebase.json @@ -1,7 +1,7 @@ { "hosting": [ { - "target": "hotwax-fulfillment", + "target": "prod", "public": "dist", "ignore": [ "firebase.json", @@ -15,7 +15,20 @@ }, { - "target": "dev-fulfillment", + "target": "dev", + "public": "dist", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ { + "source": "**", + "destination": "/index.html" + } ] + }, + { + "target": "uat", "public": "dist", "ignore": [ "firebase.json", @@ -26,7 +39,6 @@ "source": "**", "destination": "/index.html" } ] - } ] }