Skip to content
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
bfd292d
Add new preset
vcua-mobify Feb 24, 2025
6471df4
New workflow for bug bounty deploy
vcua-mobify Feb 26, 2025
bbaafa6
Fix indent
vcua-mobify Feb 26, 2025
810b7e2
Add runs-on
vcua-mobify Feb 26, 2025
1c4a6db
Install deps
vcua-mobify Feb 26, 2025
f8d52c7
temp remove step conditions
vcua-mobify Feb 26, 2025
ba8b951
set credentials file to default
vcua-mobify Feb 26, 2025
0c28536
Test version check
vcua-mobify Feb 26, 2025
d57a267
Trigger on Github release
vcua-mobify Feb 26, 2025
604e058
Test
vcua-mobify Feb 27, 2025
15283de
Test2
vcua-mobify Feb 27, 2025
ca3f3f9
test 3
vcua-mobify Feb 27, 2025
9df13a3
test 4
vcua-mobify Feb 27, 2025
40807d8
test5
vcua-mobify Feb 27, 2025
75044f5
test6
vcua-mobify Feb 27, 2025
60d36e1
test7
vcua-mobify Feb 27, 2025
91c131c
test8
vcua-mobify Feb 27, 2025
df36823
test9
vcua-mobify Feb 27, 2025
ad2d28e
test10
vcua-mobify Feb 27, 2025
85d897b
test11
vcua-mobify Feb 27, 2025
d868d2f
test12
vcua-mobify Feb 27, 2025
b08d3b7
test13
vcua-mobify Feb 27, 2025
375cadc
test 14
vcua-mobify Feb 27, 2025
4f97742
test 15
vcua-mobify Feb 27, 2025
f31a88e
test16
vcua-mobify Feb 27, 2025
a5d9b6b
test17
vcua-mobify Feb 27, 2025
daef558
test18
vcua-mobify Feb 27, 2025
a9c008d
test19
vcua-mobify Feb 27, 2025
b7abbbe
test20
vcua-mobify Feb 27, 2025
1e49dfb
test21
vcua-mobify Feb 27, 2025
b385868
test22
vcua-mobify Feb 27, 2025
6943664
test23
vcua-mobify Feb 27, 2025
9e00082
test24
vcua-mobify Feb 27, 2025
4c628b6
test25
vcua-mobify Feb 27, 2025
a4a234d
test26
vcua-mobify Feb 27, 2025
b96c79a
Restore actual changes
vcua-mobify Feb 27, 2025
3d66b85
Test by reversing condition
vcua-mobify Feb 27, 2025
272f034
Revert conditional to what we want
vcua-mobify Feb 27, 2025
c9b987c
Merge branch 'develop' into mrt-test-ci-deploy
vcua-mobify Feb 27, 2025
eed6885
apply suggestions + refactor
vcua-mobify Feb 27, 2025
b536282
flip condition for testing
vcua-mobify Feb 27, 2025
377aca5
Fix file structure
vcua-mobify Feb 27, 2025
36d6825
Add checkout
vcua-mobify Feb 27, 2025
a5e2d3b
Specify shell
vcua-mobify Feb 27, 2025
8f5583d
Set token as input
vcua-mobify Feb 27, 2025
5a47a8c
Checkout before node setup
vcua-mobify Feb 27, 2025
8c39519
Use correct condition
vcua-mobify Feb 27, 2025
0e512b8
Merge branch 'develop' into mrt-test-ci-deploy
vcua-mobify Feb 27, 2025
99dca1e
Allow custom bundle message on deploy
vcua-mobify Feb 28, 2025
8909da9
Add quotes
vcua-mobify Feb 28, 2025
809f673
Set tag name
vcua-mobify Feb 28, 2025
34e7bc1
Remove bracket
vcua-mobify Feb 28, 2025
81ea5a9
Update condition
vcua-mobify Feb 28, 2025
36ec0af
Merge branch 'develop' into mrt-test-ci-deploy
vcua-mobify Mar 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/actions/check_if_latest_release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: check_if_latest_release
inputs:
token:
description: "Github API token"
runs:
using: composite
steps:
- name: Push Bundle to MRT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should update the step name to something more descriptive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, good catch. I have the wrong name there.

id: release
run: |-
RELEASE_JSON=$(curl -s -H "Authorization: token ${{ inputs.token }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/latest")

LATEST_TAG_NAME=$(echo "$RELEASE_JSON" | jq -r '.tag_name')
RELEASE_EVENT_TAG_NAME=$(echo ${{ github.event.release.tag_name }})

echo "Latest tag: $LATEST_TAG_NAME"
echo "Release event tag: $RELEASE_EVENT_TAG_NAME"

if [ "$LATEST_TAG_NAME" == "$RELEASE_EVENT_TAG_NAME" ]; then
echo "We are releasing the latest tag. Continuing deployment workflow."
exit 0
else
echo "We are not releasing the latest tag. Stopping deployment workflow."
exit 1
fi
shell: bash
8 changes: 5 additions & 3 deletions .github/actions/push_to_mrt/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ inputs:
description: Project directory
default: ${{ github.workspace }}
TARGET:
description: MRT target
description: MRT target environment
FLAGS:
description: Push flags
PROJECT:
description: MRT target project
default: "scaffold-pwa"
runs:
using: composite
steps:
- name: Push Bundle to MRT
run: |-
cd ${{ inputs.CWD }}
project="scaffold-pwa"
build="build ${{ github.run_id }} on ${{ github.ref }} (${{ github.sha }})"
if [[ ${{ inputs.TARGET }} ]]; then
npm run push -- -s $project --message "$build" --target ${{ inputs.TARGET }} ${{ inputs.FLAGS }}
npm run push -- -s ${{ inputs.PROJECT }} --message "$build" --target ${{ inputs.TARGET }} ${{ inputs.FLAGS }}
fi
shell: bash
59 changes: 59 additions & 0 deletions .github/workflows/deploy_latest_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: SalesforceCommerceCloud/pwa-kit/deploy_latest_release
on:
# For testing - to be removed
push:
branches:
- 'mrt-test-ci-deploy'
# Run this workflow when a new Github release is published
release:
types: [released]

jobs:
check-latest-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check if latest release
uses: ./.github/actions/check_if_latest_release
with:
token: ${{ secrets.GITHUB_TOKEN }}

deploy-bug-bounty:
needs: check-latest-release
runs-on: ubuntu-latest
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
FLAGS: --cloud-origin https://cloud-testing.mobify-staging.com -c ~/.mobify --wait
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be useful if we add the tag name to the bundle name so that we know which code version the bundle is using if any bug is found?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

2 changes: 2 additions & 0 deletions e2e/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ module.exports = {
},
],
"retail-app-private-client": [],
"retail-react-app-bug-bounty": [],
},
PRESET: {
"retail-app-private-client": "retail-react-app-private-slas-client",
"retail-react-app-bug-bounty": "retail-react-app-bug-bounty",
},
EXPECTED_GENERATED_ARTIFACTS: {
"retail-app-demo": [
Expand Down
3 changes: 2 additions & 1 deletion e2e/scripts/generate-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ program
'retail-app-demo',
'retail-app-ext',
'retail-app-no-ext',
'retail-app-private-client'
'retail-app-private-client',
'retail-react-app-bug-bounty'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leveraging the generate project script in the e2e directory but it may be a good idea in the future to move this if we continue to use the script for jobs other than the e2e test CI.

]
if (!validKeys.includes(value)) {
throw new Error('Invalid project key.')
Expand Down
25 changes: 25 additions & 0 deletions packages/pwa-kit-create-app/scripts/create-mobify-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,31 @@ const PRESETS = [
assets: ['translations'],
private: true
},
{
id: 'retail-react-app-bug-bounty',
name: 'Retail React App Bug Bounty Project',
description: '',
templateSource: {
type: TEMPLATE_SOURCE_NPM,
id: '@salesforce/retail-react-app'
},
questions: [...EXTENSIBILITY_QUESTIONS, ...RETAIL_REACT_APP_QUESTIONS],
answers: {
['project.extend']: true,
['project.hybrid']: false,
['project.name']: 'retail-react-app',
['project.commerce.instanceUrl']: 'https://zzec-006.dx.commercecloud.salesforce.com',
['project.commerce.clientId']: 'b56e7ad3-2237-42c9-8f55-41e63ebca420',
['project.commerce.siteId']: 'RefArch',
['project.commerce.organizationId']: 'f_ecom_zzec_006',
['project.commerce.shortCode']: 'staging-001',
['project.einstein.clientId']: '1ea06c6e-c936-4324-bcf0-fada93f83bb1',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use a different Einstein instance to avoid affecting the analytics?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really have another Einstein instance set up for PWA tests so we use this one as a default.
This is the same Einstein instance we use in our day to day development so I don't think there'll be much of an impact if we send even more data from another test instance (which our bug bounty instance is) to it.

We can change this to a different instance if there is a need for us to specifically watch the Einstein events generated by the bug bounty instance.

['project.einstein.siteId']: 'aaij-MobileFirst',
['project.commerce.isSlasPrivate']: true
},
assets: ['translations'],
private: true
},
{
id: 'retail-react-app-hybrid-test-project',
name: 'Retail React App Hybrid Test Private SLAS Project',
Expand Down
Loading