diff --git a/.firebaserc b/.firebaserc index 7241be48..5858dc6a 100644 --- a/.firebaserc +++ b/.firebaserc @@ -6,14 +6,17 @@ "targets": { "hotwax-digital-commerce": { "hosting": { - "dev-hotwax-preorder": [ + "dev": [ "dev-hotwax-preorder" + ], + "uat": [ + "preorder-uat" ] } }, "digital-commerce-71eb8": { "hosting": { - "hotwax-preorder": [ + "prod": [ "hotwax-preorder" ] } diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 7508affa..8d02effa 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-hotwax-preorder + 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 c7f4edc1..c6c44929 100644 --- a/firebase.json +++ b/firebase.json @@ -1,7 +1,7 @@ { "hosting": [ { - "target": "dev-hotwax-preorder", + "target": "dev", "public": "dist", "ignore": [ "firebase.json", @@ -14,7 +14,20 @@ } ] }, { - "target": "hotwax-preorder", + "target": "prod", + "public": "dist", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ { + "source": "**", + "destination": "/index.html" + } ] + }, + { + "target": "uat", "public": "dist", "ignore": [ "firebase.json",