Skip to content

Commit

Permalink
Update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegoO committed Mar 20, 2024
1 parent 89ae1bd commit 6070219
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 133 deletions.
192 changes: 69 additions & 123 deletions .github/workflows/module-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# v3.200.15
# v3.200.36
name: Module CI

on:
Expand All @@ -11,6 +11,7 @@ on:
- 'README.md'
- 'LICENSE'
- '**/argoDeploy.json'
- '**/cloudDeploy.json'
- samples/**
branches:
[master, dev]
Expand All @@ -23,6 +24,7 @@ on:
- 'README.md'
- 'LICENSE'
- '**/argoDeploy.json'
- '**/cloudDeploy.json'
- samples/**

jobs:
Expand All @@ -45,11 +47,26 @@ jobs:

outputs:
artifactUrl: ${{ steps.artifactUrl.outputs.download_url }}
blobId: ${{ steps.blobRelease.outputs.blobId }}
jira-keys: ${{ steps.jira_keys.outputs.jira-keys }}
version: ${{ steps.artifact_ver.outputs.shortVersion }}
moduleId: ${{ steps.artifact_ver.outputs.moduleId }}
matrix: ${{ steps.deployment-matrix.outputs.matrix }}
run-e2e: ${{ steps.run-e2e.outputs.result }}

steps:

- name: Set up Node 18
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Set up Java 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Set RELEASE_STATUS
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
run: |
Expand Down Expand Up @@ -88,6 +105,9 @@ jobs:

- name: SonarCloud Begin
uses: VirtoCommerce/vc-github-actions/sonar-scanner-begin@master
with:
repoOrg: ${{ github.repository_owner }}
sonarOrg: ${{secrets.SONAR_ORG_KEY}}

- name: Build
run: vc-build Compile
Expand All @@ -111,17 +131,19 @@ jobs:
uses: VirtoCommerce/vc-github-actions/publish-nuget@master

- name: Publish to Blob
if: ${{ github.ref == 'refs/heads/dev' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master') }}
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master') }}
id: blobRelease
uses: VirtoCommerce/vc-github-actions/publish-blob-release@master
with:
blobSAS: ${{ secrets.BLOB_TOKEN }}
blobUrl: ${{ vars.BLOB_URL }}

- name: Add Jira link
if: ${{ github.event_name == 'pull_request' }}
uses: VirtoCommerce/vc-github-actions/publish-jira-link@master
with:
branchName: ${{ github.head_ref }}
repoOrg: ${{ github.repository_owner }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -130,24 +152,44 @@ jobs:
uses: VirtoCommerce/vc-github-actions/publish-artifact-link@master
with:
artifactUrl: ${{ steps.blobRelease.outputs.packageUrl }}
repoOrg: ${{ github.repository_owner }}
downloadComment: 'Artifact URL:'

- name: Publish Github Release
if: ${{ github.ref == 'refs/heads/master' }}
id: githubRelease
with:
changelog: ${{ steps.changelog.outputs.changelog }}
organization: ${{ github.repository_owner }}
uses: VirtoCommerce/vc-github-actions/publish-github-release@master

- name: Set artifactUrl value
id: artifactUrl
run: |
if [ '${{ github.ref }}' = 'refs/heads/master' ]; then
echo ::set-output name=download_url::${{ steps.githubRelease.outputs.downloadUrl }}
echo "download_url=${{ steps.githubRelease.outputs.downloadUrl }}" >> $GITHUB_OUTPUT
else
echo ::set-output name=download_url::${{ steps.blobRelease.outputs.packageUrl }}
echo "download_url=${{ steps.blobRelease.outputs.packageUrl }}" >> $GITHUB_OUTPUT
fi;
- name: Create deployment matrix
if: ${{ github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master'}}
uses: VirtoCommerce/vc-github-actions/cloud-create-deploy-matrix@master
id: deployment-matrix
with:
deployConfigPath: '.deployment/module/cloudDeploy.json'
releaseBranch: 'master'

- name: Check commit message for version number
id: run-e2e
run: |
if [[ "${{ github.event.head_commit.message }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]];
then
echo "result=false" >> $GITHUB_OUTPUT
else
echo "result=true" >> $GITHUB_OUTPUT
fi
- name: Setup Git Credentials
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name != 'workflow_dispatch' }}
uses: VirtoCommerce/vc-github-actions/setup-git-credentials-github@master
Expand All @@ -158,19 +200,7 @@ jobs:
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name != 'workflow_dispatch' }}
uses: VirtoCommerce/vc-github-actions/publish-manifest@master
with:
packageUrl: ${{ steps.blobRelease.outputs.packageUrl }}

- name: Update virtocommerce.com
if: ${{ github.ref == 'refs/heads/master' }}
uses: VirtoCommerce/vc-github-actions/update-virtocommercecom@master
with:
githubToken: ${{ secrets.REPO_TOKEN }}
login: ${{ secrets.VIRTOCOMMERCE_APP_ID }}
password: ${{ secrets.VIRTOCOMMERCE_SECRET }}
moduleId: ${{ steps.artifact_ver.outputs.moduleId }}
moduleDescription: ${{ steps.artifact_ver.outputs.moduleDescription }}
projectUrl: ${{ steps.artifact_ver.outputs.projectUrl }}
iconUrl: ${{ steps.artifact_ver.outputs.iconUrl }}
packageUrl: ${{ steps.artifactUrl.outputs.download_url }}

- name: Parse Jira Keys from All Commits
uses: VirtoCommerce/vc-github-actions/get-jira-keys@master
Expand All @@ -184,7 +214,7 @@ jobs:
- name: Push Build Info to Jira
if: ${{ env.CLOUD_INSTANCE_BASE_URL != 0 && env.CLIENT_ID != 0 && env.CLIENT_SECRET != 0 && steps.jira_keys.outputs.jira-keys != '' && always() }}
id: push_build_info_to_jira
uses: HighwayThree/jira-upload-build-info@master
uses: VirtoCommerce/jira-upload-build-info@master
with:
cloud-instance-base-url: '${{ secrets.CLOUD_INSTANCE_BASE_URL }}'
client-id: '${{ secrets.CLIENT_ID }}'
Expand All @@ -206,113 +236,11 @@ jobs:
run: |
echo "Jira Upload Build Info response: ${{ steps.push_build_info_to_jira.outputs.response }}"
deploy:
if: ${{ (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name == 'push' }}
needs: ci
runs-on: ubuntu-20.04
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
CLOUD_INSTANCE_BASE_URL: ${{secrets.CLOUD_INSTANCE_BASE_URL}}
CLIENT_ID: ${{secrets.CLIENT_ID}}
CLIENT_SECRET: ${{secrets.CLIENT_SECRET}}
DEPLOYMENT_ENV: 'dev'
SLEEP_TIME: '5m'
ARGO_SERVER: 'argo.govirto.com'

steps:
- name: Set DEPLOYMENT_ENV variable
if: ${{ github.ref == 'refs/heads/master' }}
run: echo "DEPLOYMENT_ENV=prod" >> $GITHUB_ENV

- name: Read deployment config
uses: VirtoCommerce/vc-github-actions/get-deploy-param@master
id: deployConfig
with:
envName: ${{ env.DEPLOYMENT_ENV }}
deployConfigPath: '.deployment/module/argoDeploy.json'

- name: Start deployment
uses: bobheadxi/deployments@master
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: ${{ steps.deployConfig.outputs.environmentName }}
no_override: false

- name: Update deployment-cm
uses: VirtoCommerce/vc-github-actions/create-deploy-pr@master
with:
deployRepo: ${{ steps.deployConfig.outputs.deployRepo }}
deployBranch: ${{ steps.deployConfig.outputs.deployBranch }}
artifactKey: ${{ steps.deployConfig.outputs.artifactKey }}
artifactUrl: ${{ needs.ci.outputs.artifactUrl }}
taskNumber: 'undefined'
forceCommit: 'true'
cmPath: ${{ steps.deployConfig.outputs.cmPath }}

- name: Sleep for ${{ env.SLEEP_TIME }}
run: sleep ${{ env.SLEEP_TIME }}
shell: bash

- name: Wait for environment is up
uses: VirtoCommerce/vc-github-actions/vc-argocd-cli@master
timeout-minutes: 10
id: argocd-cli
with:
server: ${{env.ARGO_SERVER}}
username: ${{ secrets.ARGOCD_LOGIN }}
password: ${{ secrets.ARGOCD_PASSWORD }}
command: app wait ${{ steps.deployConfig.outputs.deployAppName }}

- name: DEPLOY_STATE::successful
if: success()
run: echo "DEPLOY_STATE=successful" >> $GITHUB_ENV

- name: DEPLOY_STATE::failed
if: failure()
run: echo "DEPLOY_STATE=failed" >> $GITHUB_ENV

- name: Update GitHub deployment status
uses: bobheadxi/deployments@master
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}

- name: Push Deployment Info to Jira
if: ${{ env.CLOUD_INSTANCE_BASE_URL != 0 && env.CLIENT_ID != 0 && env.CLIENT_SECRET != 0 && needs.ci.outputs.jira-keys != '' && always() }}
id: push_deployment_info_to_jira
uses: HighwayThree/jira-upload-deployment-info@master
env:
CLOUD_INSTANCE_BASE_URL: ${{secrets.CLOUD_INSTANCE_BASE_URL}}
CLIENT_ID: ${{secrets.CLIENT_ID}}
CLIENT_SECRET: ${{secrets.CLIENT_SECRET}}
with:
cloud-instance-base-url: ${{ secrets.CLOUD_INSTANCE_BASE_URL }}
client-id: ${{ secrets.CLIENT_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
deployment-sequence-number: ${{ github.run_id }}
update-sequence-number: ${{ github.run_id }}
issue-keys: ${{ needs.ci.outputs.jira-keys }}
display-name: ${{ steps.deployConfig.outputs.deployAppName }}
url: ${{ steps.deployConfig.outputs.environmentUrl }}
description: 'Deployment to the ${{ steps.deployConfig.outputs.environmentName }} environment'
last-updated: '${{github.event.head_commit.timestamp}}'
state: '${{ env.DEPLOY_STATE }}'
pipeline-id: '${{ github.repository }} ${{ github.workflow }}'
pipeline-display-name: 'Workflow: ${{ github.workflow }} (#${{ github.run_number }})'
pipeline-url: '${{github.event.repository.html_url}}/actions/runs/${{github.run_id}}'
environment-id: ${{ steps.deployConfig.outputs.environmentId }}
environment-display-name: ${{ steps.deployConfig.outputs.environmentName }}
environment-type: ${{ steps.deployConfig.outputs.environmentType }}

module-katalon-tests:
if: ${{ github.event_name == 'pull_request' }}
if: ${{ ((github.ref == 'refs/heads/dev') && (github.event_name == 'push') && (needs.ci.outputs.run-e2e == 'true')) ||
(github.event_name == 'workflow_dispatch')}}
needs: 'ci'
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@main
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@v3.200.36
with:
katalonRepo: 'VirtoCommerce/vc-quality-gate-katalon'
katalonRepoBranch: 'dev'
Expand All @@ -321,6 +249,24 @@ jobs:
installCustomModule: 'true'
customModuleId: ${{ needs.ci.outputs.moduleId }}
customModuleUrl: ${{ needs.ci.outputs.artifactUrl }}
platformDockerTag: 'dev-linux-latest'
storefrontDockerTag: 'dev-linux-latest'
secrets:
envPAT: ${{ secrets.REPO_TOKEN }}
katalonApiKey: ${{ secrets.KATALON_API_KEY }}

deploy-cloud:
if: ${{ ((github.ref == 'refs/heads/master') ||
(github.ref == 'refs/heads/dev')) &&
github.event_name == 'push' }}
needs: ci
uses: VirtoCommerce/.github/.github/workflows/[email protected]
with:
releaseSource: module
moduleId: ${{ needs.ci.outputs.moduleId }}
moduleVer: ${{ needs.ci.outputs.version }}
moduleBlob: ${{ needs.ci.outputs.blobId }}
jiraKeys: ${{ needs.ci.outputs.jira-keys }}
argoServer: 'argo.virtocommerce.cloud'
matrix: '{"include":${{ needs.ci.outputs.matrix }}}'
secrets: inherit
8 changes: 4 additions & 4 deletions .github/workflows/module-release-hotfix.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# v3.200.30
# v3.200.36
name: Release hotfix

on:
Expand All @@ -12,12 +12,12 @@ on:

jobs:
test:
uses: VirtoCommerce/.github/.github/workflows/[email protected].30
uses: VirtoCommerce/.github/.github/workflows/[email protected].36
secrets:
sonarToken: ${{ secrets.SONAR_TOKEN }}

build:
uses: VirtoCommerce/.github/.github/workflows/[email protected].30
uses: VirtoCommerce/.github/.github/workflows/[email protected].36
with:
uploadPackage: 'true'
uploadDocker: 'false'
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
publish-github-release:
needs:
[build, test, get-metadata]
uses: VirtoCommerce/.github/.github/workflows/[email protected].30
uses: VirtoCommerce/.github/.github/workflows/[email protected].36
with:
fullKey: ${{ needs.build.outputs.packageFullKey }}
changeLog: '${{ needs.get-metadata.outputs.changeLog }}'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish-nugets.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# v3.200.13-fix
# v3.200.36
name: Publish nuget

on:
Expand All @@ -12,12 +12,12 @@ on:

jobs:
test:
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@main
uses: VirtoCommerce/.github/.github/workflows/test-and-sonar.yml@v3.200.36
secrets:
sonarToken: ${{ secrets.SONAR_TOKEN }}

build:
uses: VirtoCommerce/.github/.github/workflows/build.yml@main
uses: VirtoCommerce/.github/.github/workflows/build.yml@v3.200.36
with:
uploadPackage: 'true'
uploadDocker: 'false'
Expand All @@ -28,7 +28,7 @@ jobs:
publish-nuget:
needs:
[build, test]
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@main
uses: VirtoCommerce/.github/.github/workflows/publish-github.yml@v3.200.36
with:
fullKey: ${{ needs.build.outputs.packageFullKey }}
forceGithub: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# v1.0.0-fix
# v3.200.36
name: Release

on:
workflow_dispatch:

jobs:
release:
uses: VirtoCommerce/.github/.github/workflows/release.yml@main
uses: VirtoCommerce/.github/.github/workflows/release.yml@v3.200.36
secrets:
envPAT: ${{ secrets.REPO_TOKEN }}

0 comments on commit 6070219

Please sign in to comment.