|
1 | 1 | name: SalesforceCommerceCloud/pwa-kit/bug_bounty |
2 | 2 | on: |
| 3 | + # For testing - to be removed |
3 | 4 | push: |
4 | 5 | branches: |
5 | 6 | - 'mrt-test-ci-deploy' |
| 7 | + # Run this job when a new Github release is published |
| 8 | + release: |
| 9 | + types: [released] |
6 | 10 |
|
7 | 11 | jobs: |
8 | 12 | deploy-bug-bounty: |
9 | 13 | runs-on: ubuntu-latest |
10 | 14 | steps: |
11 | 15 | - name: Check if latest release |
12 | 16 | id: release |
13 | | - run: | |
| 17 | + run: |- |
14 | 18 | RELEASE_JSON=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ |
15 | 19 | "https://api.github.com/repos/${{ github.repository }}/releases/latest") |
16 | 20 |
|
17 | 21 | LATEST_TAG_NAME=$(echo "$RELEASE_JSON" | jq -r '.tag_name') |
18 | 22 | RELEASE_EVENT_TAG_NAME=$(echo ${{ github.event.release.tag_name }}) |
| 23 | +
|
| 24 | + echo "Latest tag: $LATEST_TAG_NAME" |
| 25 | + echo "Release event tag: $RELEASE_EVENT_TAG_NAME" |
| 26 | +
|
19 | 27 | if [ "$LATEST_TAG_NAME" == "$RELEASE_EVENT_TAG_NAME" ]; then |
20 | | - echo "true" |
| 28 | + echo "We are releasing the latest. Continuing to deploy to bug bounty instance" |
21 | 29 | echo "IS_LATEST_RELEASE=true" >> $GITHUB_ENV |
22 | | - else |
23 | | - echo "false" |
24 | | - echo "IS_LATEST_RELEASE=false" >> $GITHUB_ENV |
25 | 30 | fi |
26 | 31 |
|
27 | | - echo "Latest tag: $LATEST_TAG_NAME" |
28 | | - echo "Release event tag: $RELEASE_EVENT_TAG_NAME" |
29 | | - echo "Is latest release: ${{ env.IS_LATEST_RELEASE }}" |
30 | | - |
31 | | - - name: Test env var true |
| 32 | + - name: Checkout |
| 33 | + if: env.IS_LATEST_RELEASE == 'true' |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Install Monorepo Dependencies |
| 37 | + if: env.IS_LATEST_RELEASE == 'true' |
| 38 | + run: |- |
| 39 | + # Install node dependencies |
| 40 | + node ./scripts/gtime.js monorepo_install npm ci |
| 41 | +
|
| 42 | + - name: Generate Retail App Demo |
| 43 | + if: env.IS_LATEST_RELEASE == 'true' |
| 44 | + uses: ./.github/actions/e2e_generate_app |
| 45 | + with: |
| 46 | + PROJECT_KEY: "retail-react-app-bug-bounty" |
| 47 | + |
| 48 | + - name: Create MRT credentials file |
| 49 | + if: env.IS_LATEST_RELEASE == 'true' |
| 50 | + uses: "./.github/actions/create_mrt" |
| 51 | + with: |
| 52 | + mobify_user: ${{ secrets.MOBIFY_STG_CLIENT_USER }} |
| 53 | + mobify_api_key: ${{ secrets.MOBIFY_STG_CLIENT_API_KEY }} |
| 54 | + |
| 55 | + - name: Push Bundle to MRT (Bug Bounty) |
32 | 56 | if: env.IS_LATEST_RELEASE == 'true' |
33 | | - run: | |
34 | | - echo "true" |
35 | | - |
36 | | - - name: Test env var false |
37 | | - if: env.IS_LATEST_RELEASE == 'false' |
38 | | - run: | |
39 | | - echo "false" |
| 57 | + uses: "./.github/actions/push_to_mrt" |
| 58 | + with: |
| 59 | + CWD: "../generated-projects/retail-react-app-bug-bounty" |
| 60 | + TARGET: testing |
| 61 | + PROJECT: pwa-kit |
| 62 | + FLAGS: --cloud-origin https://cloud-testing.mobify-staging.com -c ~/.mobify --wait |
0 commit comments