Deploy demo site #52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SalesforceCommerceCloud/pwa-kit/deploy_latest_release | |
| on: | |
| # For testing - to be removed | |
| push: | |
| branches: | |
| - 'deploy-demo-env-on-release' | |
| # Run this workflow when a new Github release is published | |
| release: | |
| types: [released] | |
| jobs: | |
| check-latest-release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| IS_LATEST_RELEASE: ${{ steps.checkRelease.outputs.IS_LATEST_RELEASE }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Check if latest release | |
| uses: ./.github/actions/check_if_latest_release | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update Github Outputs | |
| id: checkRelease | |
| run: |- | |
| IS_LATEST_RELEASE=$(echo ${{ env.IS_LATEST_RELEASE }}) | |
| echo "IS_LATEST_RELEASE=${{ env.IS_LATEST_RELEASE }}" >> "$GITHUB_OUTPUT" | |
| if [ $IS_LATEST_RELEASE != "true" ]; then | |
| echo "Deploy is not for the latest release. Stopping deployment" | |
| fi | |
| deploy-bug-bounty: | |
| needs: check-latest-release | |
| runs-on: ubuntu-latest | |
| if: needs.check-latest-release.outputs.IS_LATEST_RELEASE == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| id: setup_node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: "npm" | |
| - name: Install Monorepo Dependencies | |
| run: |- | |
| # Install node dependencies | |
| node ./scripts/gtime.js monorepo_install npm ci | |
| - name: Generate Retail App Demo | |
| uses: ./.github/actions/e2e_generate_app | |
| with: | |
| PROJECT_KEY: "retail-react-app-bug-bounty" | |
| - name: Create MRT credentials file | |
| uses: "./.github/actions/create_mrt" | |
| with: | |
| mobify_user: ${{ secrets.MOBIFY_STG_CLIENT_USER }} | |
| mobify_api_key: ${{ secrets.MOBIFY_STG_CLIENT_API_KEY }} | |
| - name: Push Bundle to MRT (Bug Bounty) | |
| uses: "./.github/actions/push_to_mrt" | |
| with: | |
| CWD: "../generated-projects/retail-react-app-bug-bounty" | |
| TARGET: testing | |
| PROJECT: pwa-kit | |
| MESSAGE: "tag ${{ github.event.release.tag_name }}" | |
| FLAGS: --cloud-origin https://cloud-testing.mobify-staging.com -c ~/.mobify --wait | |
| deploy-demo-site: | |
| needs: check-latest-release | |
| runs-on: ubuntu-latest | |
| if: needs.check-latest-release.outputs.IS_LATEST_RELEASE != 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| id: setup_node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: "npm" | |
| - name: Install Monorepo Dependencies | |
| run: |- | |
| # Install node dependencies | |
| node ./scripts/gtime.js monorepo_install npm ci | |
| - name: Generate Retail App Demo | |
| uses: ./.github/actions/e2e_generate_app | |
| with: | |
| PROJECT_KEY: "retail-react-app-demo-site" | |
| - name: Create MRT credentials file | |
| uses: "./.github/actions/create_mrt" | |
| with: | |
| mobify_user: ${{ secrets.MOBIFY_CLIENT_USER }} | |
| mobify_api_key: ${{ secrets.MOBIFY_CLIENT_API_KEY }} | |
| - name: Push Bundle to MRT (Demo Site) | |
| uses: "./.github/actions/push_to_mrt" | |
| with: | |
| CWD: "../generated-projects/retail-react-app-demo-site" | |
| TARGET: production | |
| PROJECT: scaffold-pwa | |
| MESSAGE: "tag ${{ github.event.release.tag_name }}" | |
| FLAGS: --wait |