Skip to content

Commit 7379069

Browse files
committed
Update workflow
1 parent a717bbb commit 7379069

4 files changed

Lines changed: 82 additions & 29 deletions

File tree

.github/workflows/module-ci.yml

Lines changed: 69 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# v3.800.15
2-
# https://virtocommerce.atlassian.net/browse/VCST-3725
1+
# v3.800.24
2+
# https://virtocommerce.atlassian.net/browse/VCST-4487
33
name: Module CI
44

55
on:
@@ -27,11 +27,11 @@ on:
2727
- '**/argoDeploy.json'
2828
- '**/cloudDeploy.json'
2929
- samples/**
30-
30+
3131
jobs:
3232
ci:
33-
if: ${{ github.actor != 'dependabot[bot]' &&
34-
(github.event.pull_request.head.repo.full_name == github.repository ||
33+
if: ${{ github.actor != 'dependabot[bot]' &&
34+
(github.event.pull_request.head.repo.full_name == github.repository ||
3535
github.event.pull_request.head.repo.full_name == '') }} # Check that PR not from forked repo and not from Dependabot
3636
runs-on: ubuntu-24.04
3737
env:
@@ -56,6 +56,7 @@ jobs:
5656
run-e2e: ${{ steps.run-e2e.outputs.result }}
5757
run-ui-tests: ${{ steps.run-ui-tests.outputs.result }}
5858
deployment-folder-exists: ${{ steps.check_deployment_folder.outputs.exists }}
59+
requiredModulesListUrl: ${{ steps.extract_required_modules_list_url_from_pr.outputs.url }}
5960

6061
steps:
6162

@@ -140,7 +141,7 @@ jobs:
140141

141142
- name: Packaging
142143
run: vc-build Compress -skip Clean+Restore+Compile+Test
143-
144+
144145
- name: Publish Nuget
145146
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
146147
uses: VirtoCommerce/vc-github-actions/publish-nuget@master
@@ -152,12 +153,27 @@ jobs:
152153
with:
153154
blobSAS: ${{ secrets.BLOB_TOKEN }}
154155
blobUrl: ${{ vars.BLOB_URL }}
155-
156+
157+
- name: Sanitize branch name
158+
if: ${{ github.event_name == 'pull_request' }}
159+
id: sanitize_branch
160+
env:
161+
BRANCH_NAME: ${{ github.head_ref }}
162+
run: |
163+
# Keep only alphanumeric, hyphens, underscores, and forward slashes and limit length to 255 characters.
164+
SANITIZED_BRANCH=$(printf '%s\n' "$BRANCH_NAME" | sed 's/[^-a-zA-Z0-9_/]//g' | cut -c1-255)
165+
if [ -z "$SANITIZED_BRANCH" ]; then
166+
echo "branch name is empty"
167+
exit 1
168+
else
169+
echo "branchName=$SANITIZED_BRANCH" >> $GITHUB_OUTPUT
170+
fi
171+
156172
- name: Add Jira link
157173
if: ${{ github.event_name == 'pull_request' }}
158174
uses: VirtoCommerce/vc-github-actions/publish-jira-link@master
159175
with:
160-
branchName: ${{ github.head_ref }}
176+
branchName: ${{ steps.sanitize_branch.outputs.branchName }}
161177
repoOrg: ${{ github.repository_owner }}
162178
env:
163179
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -177,7 +193,7 @@ jobs:
177193
changelog: ${{ steps.changelog.outputs.changelog }}
178194
organization: ${{ github.repository_owner }}
179195
uses: VirtoCommerce/vc-github-actions/publish-github-release@master
180-
196+
181197
- name: Set artifactUrl value
182198
id: artifactUrl
183199
run: |
@@ -197,14 +213,46 @@ jobs:
197213

198214
- name: Check commit message for version number
199215
id: run-e2e
216+
env:
217+
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
200218
run: |
201-
if [[ "${{ github.event.head_commit.message }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]];
219+
if [[ "$COMMIT_MESSAGE" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]];
202220
then
203221
echo "result=false" >> $GITHUB_OUTPUT
204222
else
205223
echo "result=true" >> $GITHUB_OUTPUT
206224
fi
207225
226+
- name: Extract required modules list URL from the pull request description
227+
if: ${{ github.event_name == 'pull_request' }}
228+
id: extract_required_modules_list_url_from_pr
229+
shell: pwsh
230+
env:
231+
PR_BODY: ${{ github.event.pull_request.body }}
232+
run: |
233+
$text = $env:PR_BODY
234+
$marker = 'Required modules list URL'
235+
236+
$url = ''
237+
if ($null -ne $text -and $text.Contains($marker)) {
238+
$startIndex = $text.IndexOf($marker)
239+
if ($startIndex -ge 0) {
240+
$slice = $text.Substring($startIndex)
241+
$match = [regex]::Match($slice, 'https?://[^ )\r\n]+')
242+
if ($match.Success) {
243+
$url = $match.Value
244+
}
245+
}
246+
}
247+
248+
if ([string]::IsNullOrWhiteSpace($url) -eq $false) {
249+
Write-Host "url found: $url"
250+
Add-Content -Path $env:GITHUB_OUTPUT -Value "url=$url"
251+
} else {
252+
Write-Host "url NOT found"
253+
Add-Content -Path $env:GITHUB_OUTPUT -Value "url="
254+
}
255+
208256
- name: Look for xapi module in dependencies
209257
id: run-ui-tests
210258
shell: pwsh
@@ -229,9 +277,9 @@ jobs:
229277
- name: Setup Git Credentials
230278
if: ${{ (github.ref == 'refs/heads/dev' && github.event_name != 'workflow_dispatch') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
231279
uses: VirtoCommerce/vc-github-actions/setup-git-credentials-github@master
232-
with:
280+
with:
233281
githubToken: ${{ secrets.REPO_TOKEN }}
234-
282+
235283
- name: Publish Manifest
236284
if: ${{ (github.ref == 'refs/heads/dev' && github.event_name != 'workflow_dispatch') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
237285
uses: VirtoCommerce/vc-github-actions/publish-manifest@master
@@ -276,21 +324,25 @@ jobs:
276324
if: ${{ ((github.ref == 'refs/heads/dev') && (github.event_name == 'push')) ||
277325
(github.event_name == 'workflow_dispatch') || ((github.base_ref == 'dev') && (github.event_name == 'pull_request')) }}
278326
needs: 'ci'
279-
uses: VirtoCommerce/.github/.github/workflows/ui-autotests.yml@v3.800.15
327+
uses: VirtoCommerce/.github/.github/workflows/ui-autotests.yml@v3.800.24
280328
with:
281329
installModules: 'false'
282330
installCustomModule: 'true'
283331
customModuleId: ${{ needs.ci.outputs.moduleId }}
284332
customModuleUrl: ${{ needs.ci.outputs.artifactUrl }}
285333
runTests: ${{ needs.ci.outputs.run-ui-tests }}
334+
vctestingRepoBranch: 'dev'
335+
frontendZipUrl: 'latest'
286336
secrets:
287337
envPAT: ${{ secrets.REPO_TOKEN }}
288-
338+
testSecretEnvFile: ${{ secrets.VC_TESTING_MODULE_ENV_FILE }}
339+
sendgridApiKey: ${{ secrets.SENDGRID_APIKEY_4E2E_AUTOTESTS }}
340+
289341
module-katalon-tests:
290342
if: ${{ ((github.ref == 'refs/heads/dev') && (github.event_name == 'push') && (needs.ci.outputs.run-e2e == 'true')) ||
291343
(github.event_name == 'workflow_dispatch') || (github.base_ref == 'dev') && (github.event_name == 'pull_request') }}
292344
needs: 'ci'
293-
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@v3.800.15
345+
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@v3.800.24
294346
with:
295347
katalonRepo: 'VirtoCommerce/vc-quality-gate-katalon'
296348
katalonRepoBranch: 'dev'
@@ -299,6 +351,7 @@ jobs:
299351
installCustomModule: 'true'
300352
customModuleId: ${{ needs.ci.outputs.moduleId }}
301353
customModuleUrl: ${{ needs.ci.outputs.artifactUrl }}
354+
requiredModulesListUrl: ${{ needs.ci.outputs.requiredModulesListUrl }}
302355
platformDockerTag: 'dev-linux-latest'
303356
storefrontDockerTag: 'dev-linux-latest'
304357
secrets:
@@ -310,7 +363,7 @@ jobs:
310363
&& github.event_name == 'push'
311364
&& needs.ci.outputs.deployment-folder-exists == 'true'}}
312365
needs: ci
313-
uses: VirtoCommerce/.github/.github/workflows/deploy-cloud.yml@v3.800.15
366+
uses: VirtoCommerce/.github/.github/workflows/deploy-cloud.yml@v3.800.24
314367
with:
315368
releaseSource: module
316369
moduleId: ${{ needs.ci.outputs.moduleId }}

.github/workflows/module-release-hotfix.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# v3.800.15
2-
# https://virtocommerce.atlassian.net/browse/VCST-3725
1+
# v3.800.24
2+
# https://virtocommerce.atlassian.net/browse/VCST-4487
33
name: Release hotfix
44

55
on:
@@ -13,12 +13,12 @@ on:
1313

1414
jobs:
1515
test:
16-
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.15
16+
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.24
1717
secrets:
1818
sonarToken: ${{ secrets.SONAR_TOKEN }}
1919

2020
build:
21-
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.15
21+
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.24
2222
with:
2323
uploadPackage: 'true'
2424
uploadDocker: 'false'
@@ -46,7 +46,7 @@ jobs:
4646
publish-github-release:
4747
needs:
4848
[build, test, get-metadata]
49-
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.15
49+
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.24
5050
with:
5151
fullKey: ${{ needs.build.outputs.packageFullKey }}
5252
changeLog: '${{ needs.get-metadata.outputs.changeLog }}'

.github/workflows/publish-nugets.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# v3.800.15
2-
# https://virtocommerce.atlassian.net/browse/VCST-3725
1+
# v3.800.24
2+
# https://virtocommerce.atlassian.net/browse/VCST-4487
33
name: Publish nuget
44

55
on:
@@ -13,12 +13,12 @@ on:
1313

1414
jobs:
1515
test:
16-
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.15
16+
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.800.24
1717
secrets:
1818
sonarToken: ${{ secrets.SONAR_TOKEN }}
1919

2020
build:
21-
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.15
21+
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.800.24
2222
with:
2323
uploadPackage: 'true'
2424
uploadDocker: 'false'
@@ -29,7 +29,7 @@ jobs:
2929
publish-nuget:
3030
needs:
3131
[build, test]
32-
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.15
32+
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.800.24
3333
with:
3434
fullKey: ${{ needs.build.outputs.packageFullKey }}
3535
forceGithub: false

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# v3.800.15
2-
# https://virtocommerce.atlassian.net/browse/VCST-3725
1+
# v3.800.24
2+
# https://virtocommerce.atlassian.net/browse/VCST-4487
33
name: Release
44

55
on:
66
workflow_dispatch:
77

88
jobs:
99
release:
10-
uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.800.15
10+
uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.800.24
1111
secrets:
1212
envPAT: ${{ secrets.REPO_TOKEN }}

0 commit comments

Comments
 (0)