-
Notifications
You must be signed in to change notification settings - Fork 8
119 lines (118 loc) · 4.48 KB
/
deploy-connect.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
name: Deploy plugin to CT Connect
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Deploy to connect environment
required: true
options:
- connect_dev
- connect_prod
- dev
- prod
connector_key:
type: string
description: ConnectorStaged key (also used for deployment)
required: true
default: commercetools-klaviyo
node_config:
type: string
description: Stringified and escaped JSON to override all plugin configurations
required: false
jobs:
ct-authorize:
name: 'Authenticate with commercetools'
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
outputs:
access_token: ${{ fromJSON(steps.authenticate.outputs.output).data.access_token }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Authenticate
id: authenticate
uses: ./.github/actions/connect/authenticate
with:
ct_api_client_id: ${{ secrets.CT_CLIENT_ID }}
ct_api_client_secret: ${{ secrets.CT_CLIENT_SECRET }}
ct_auth_url: ${{ vars.CT_AUTH_URL }}
ct-update-tag:
name: 'Update Connector Tag'
runs-on: ubuntu-latest
needs: ['ct-authorize']
environment: ${{ github.event.inputs.environment }}
outputs:
connector: ${{ steps.update-tag.outputs.output }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get and update Connector
id: update-tag
uses: ./.github/actions/connect/update-tag
with:
tag: ${{ github.ref_name }}
access_token: ${{ needs.ct-authorize.outputs.access_token }}
ct_connect_url: ${{ vars.CT_CONNECT_API_URL }}
connector_key: ${{ github.event.inputs.connector_key }}
ct-request-previewable:
name: 'Request Previewable Access'
runs-on: ubuntu-latest
needs: ['ct-authorize', 'ct-update-tag']
environment: ${{ github.event.inputs.environment }}
outputs:
connector: ${{ steps.request-previewable.outputs.response }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Request Previewable Access
id: request-previewable
uses: ./.github/actions/connect/request-previewable
with:
version: ${{ fromJSON(needs.ct-update-tag.outputs.connector).data.version }}
access_token: ${{ needs.ct-authorize.outputs.access_token }}
ct_connect_url: ${{ vars.CT_CONNECT_API_URL }}
connector_key: ${{ github.event.inputs.connector_key }}
ct-undeploy:
name: 'Check and Undeploy Connector'
runs-on: ubuntu-latest
needs: ['ct-authorize', 'ct-request-previewable']
environment: ${{ github.event.inputs.environment }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check and Undeploy Connector
id: undeploy
uses: ./.github/actions/connect/undeploy
with:
access_token: ${{ needs.ct-authorize.outputs.access_token }}
ct_project_id: ${{ vars.CT_PROJECT_ID }}
ct_connect_url: ${{ vars.CT_CONNECT_API_URL }}
connect_env: ${{ github.event.inputs.environment }}
connector_key: ${{ github.event.inputs.connector_key }}
ct-deploy:
name: 'Deploy Connector'
runs-on: ubuntu-latest
needs: ['ct-authorize', 'ct-request-previewable', 'ct-undeploy']
environment: ${{ github.event.inputs.environment }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Deploy Connector
id: deploy
uses: ./.github/actions/connect/deploy
with:
version: ${{ fromJSON(needs.ct-request-previewable.outputs.connector).version }}
access_token: ${{ needs.ct-authorize.outputs.access_token }}
is_previewable: ${{ fromJSON(needs.ct-request-previewable.outputs.connector).isPreviewable }}
ct_api_client_id: ${{ secrets.CT_CLIENT_ID }}
ct_api_client_secret: ${{ secrets.CT_CLIENT_SECRET }}
ct_api_url: ${{ vars.CT_API_URL }}
ct_auth_url: ${{ vars.CT_AUTH_URL }}
ct_project_id: ${{ vars.CT_PROJECT_ID }}
ct_scopes: ${{ vars.CT_SCOPES }}
ct_connect_url: ${{ vars.CT_CONNECT_API_URL }}
klaviyo_auth_key: ${{ secrets.KLAVIYO_AUTH_KEY }}
connect_env: ${{ github.event.inputs.environment }}
connector_key: ${{ github.event.inputs.connector_key }}
node_config: ${{ github.event.inputs.node_config }}