Skip to content

VC deployment

VC deployment #126

Workflow file for this run

# v1.3.0
name: VC deployment
on:
workflow_dispatch:
inputs:
artifactUrl:
description: 'Full link to artifact docker image or artifact download url'
required: true
deployEnvironment:
description: 'Deployment environment type. Allowed values: dev, qa, prod'
required: true
default: 'dev'
deployConfigPath:
description: 'Full path to argoDeploy.json'
required: true
default: 'argoDeploy.json'
jiraKeys:
description: 'Deployed artifact Jira keys (for cycle time report)'
required: false
default: ''
jobs:
cd:
runs-on: ubuntu-latest
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}}
SLEEP_TIME: '5m'
ARGO_SERVER: 'argo.govirto.com'
steps:
- name: Install vc-build
run: |
dotnet tool install --global VirtoCommerce.GlobalTool
- name: Set Output
id: app-name
run: |
if [ ${{ github.ref }} == 'refs/heads/master' ]; then
echo "IS master branch"
echo "::set-output name=APP::vcst-demo"
elif [ ${{ github.ref }} == 'refs/heads/dev' ]; then
echo "IS dev branch"
echo "::set-output name=APP::vcst-dev"
fi
- name: Read deployment config
uses: VirtoCommerce/vc-github-actions/get-deploy-param@master
id: deployConfig
with:
envName: ${{ github.event.inputs.deployEnvironment }}
deployConfigPath: ${{ github.event.inputs.deployConfigPath }}
- 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 environment
run: |
vc-build SetEnvParameter -EnvironmentName ${{ steps.app-name.outputs.APP }} -CloudToken ${{ secrets.VCST_PLATFORM_TOKEN }} -HelmParameters storefront.image.tag=${{ github.event.inputs.artifactUrl }}
- 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 && github.event.inputs.jiraKeys != '' && 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: ${{ github.event.inputs.jiraKeys }}
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 }}