-
Notifications
You must be signed in to change notification settings - Fork 212
119 lines (106 loc) · 4.67 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# 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 "APP=vcptcore-qa" >> $GITHUB_OUTPUT
elif [ ${{ github.ref }} == 'refs/heads/dev' ]; then
echo "IS dev branch"
echo "APP=vcst-dev" >> $GITHUB_OUTPUT
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: VirtoCommerce/vc-github-actions/gh-deployments@master
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: ${{ steps.deployConfig.outputs.environmentName }}
no_override: false
- name: Update vcptcore-qa environment
if: ${{ github.ref == 'refs/heads/master' }}
run: |
vc-build CloudEnvSetParameter -EnvironmentName ${{ steps.app-name.outputs.APP }} -CloudToken ${{ secrets.VCPTCORE_PLATFORM_TOKEN }} -HelmParameters storefront.image.tag=${{ github.event.inputs.artifactUrl }}
- name: Update vcst-dev environment
if: ${{ github.ref == 'refs/heads/dev' }}
run: |
vc-build CloudEnvSetParameter -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: VirtoCommerce/vc-github-actions/gh-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: VirtoCommerce/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 }}