-
Notifications
You must be signed in to change notification settings - Fork 212
@W-17760517@ Automatically update bug bounty instance on new release #2291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 48 commits
bfd292d
6471df4
bbaafa6
810b7e2
1c4a6db
f8d52c7
ba8b951
0c28536
d57a267
604e058
15283de
ca3f3f9
9df13a3
40807d8
75044f5
60d36e1
91c131c
df36823
ad2d28e
85d897b
d868d2f
b08d3b7
375cadc
4f97742
f31a88e
a5d9b6b
daef558
a9c008d
b7abbbe
1e49dfb
b385868
6943664
9e00082
4c628b6
a4a234d
b96c79a
3d66b85
272f034
c9b987c
eed6885
b536282
377aca5
36d6825
a5e2d3b
8f5583d
5a47a8c
8c39519
0e512b8
99dca1e
8909da9
809f673
34e7bc1
81ea5a9
36ec0af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| 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 | ||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added! |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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' | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use a different Einstein instance to avoid affecting the analytics?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. 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', | ||
|
|
||
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.