-
Notifications
You must be signed in to change notification settings - Fork 12
168 lines (164 loc) · 6.83 KB
/
ci.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: CI
on:
push:
branches:
- master
- release/1.0.0
# - feature/*
pull_request:
branches:
- bugfix/*
- feature/*
- hotfix/*
- release/*
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build and Test
shell: bash
run: |
echo "Build and Test as asdfsdf asdf asdfs sadfsd asdfsdff bbccccdddd asdfd asdf yyyyy asd asdf asdfdf "
echo "BUILD_STATE=successful" >> $GITHUB_ENV
- name: Failed Build
if: failure()
run: echo "BUILD_STATE=failed" >> $GITHUB_ENV
- name: Parse Jira Keys from Commit
id: jira_keys
if: always()
uses: HighwayThree/jira-extract-issue-keys@master
with:
is-pull-request: ${{ github.event_name == 'pull_request' }}
parse-all-commits: ${{ github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push Build Info to Jira
if: steps.jira_keys.outputs.jira-keys != ''
id: push_build_info_to_jira
uses: HighwayThree/jira-upload-build-info@master
with:
cloud-id: '${{ secrets.CLOUD_ID }}'
client-id: '${{ secrets.CLIENT_ID }}'
client-secret: '${{ secrets.CLIENT_SECRET }}'
pipeline-id: '${{ github.repository }} ${{ github.workflow }}'
build-number: ${{ github.run_number }}
build-display-name: 'Workflow: ${{ github.workflow }} (#${{ github.run_number }})'
build-state: "${{ env.BUILD_STATE }}"
build-url: '${{github.event.repository.url}}/actions/runs/${{github.run_id}}'
update-sequence-number: '${{ github.run_id }}'
last-updated: '${{github.event.head_commit.timestamp}}'
issue-keys: "${{ steps.jira_keys.outputs.jira-keys }}"
commit-id: '${{ github.sha }}'
repo-url: '${{ github.event.repository.url }}'
build-ref-url: '${{ github.event.repository.url }}/actions/runs/${{ github.run_id }}'
- name: Confirm Jira Build Output
if: success()
run: |
echo "Jira Upload Build Info response: ${{ steps.push_build_info_to_jira.outputs.response }}"
deploy_to_test:
runs-on: ubuntu-latest
needs: build_and_test
if: github.event_name == 'push' && github.ref == 'refs/heads/release/1.0.0'
steps:
- name: Deploy to Test
run: |
echo "Deploying to Test..."
echo "github.event_name: ${{github.event_name}}"
echo "github.ref: ${{github.ref}}"
echo "DEPLOY_STATE=successful" >> $GITHUB_ENV
- name: Failed Deployment
if: failure()
run: echo "DEPLOY_STATE=failed" >> $GITHUB_ENV
- name: Parse Jira Keys from All Commits
id: jira_keys
if: always()
uses: HighwayThree/jira-extract-issue-keys@master
with:
is-pull-request: ${{ github.event_name == 'pull_request' }}
parse-all-commits: ${{ github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Confirm Deploy State and Jira Key Values
if: always()
run: |
echo "DEPLOY_STATE: ${{env.DEPLOY_STATE}}"
echo "Jira Keys: ${{steps.jira_keys.outputs.jira-keys}}"
- name: Push Deployment Info to Jira
if: steps.jira_keys.outputs.jira-keys != ''
id: push_deployment_info_to_jira
uses: HighwayThree/jira-upload-deployment-info@master
with:
cloud-id: '${{ secrets.CLOUD_ID }}'
client-id: '${{ secrets.CLIENT_ID }}'
client-secret: '${{ secrets.CLIENT_SECRET }}'
deployment-sequence-number: '${{ github.run_id }}'
update-sequence-number: '${{ github.run_id }}'
issue-keys: "${{ steps.jira_keys.outputs.jira-keys }}"
display-name: "Deployment number asdf"
url: "${{github.event.repository.url}}/actions/runs/${{github.run_id}}"
description: "Test Deployment"
last-updated: '${{github.event.head_commit.timestamp}}'
label: 'Test Deployment Label'
state: '${{env.DEPLOY_STATE}}'
pipeline-id: '${{ github.repository }} ${{ github.workflow }}'
pipeline-display-name: 'Workflow: ${{ github.workflow }} (#${{ github.run_number }})'
pipeline-url: '${{github.event.repository.url}}/actions/runs/${{github.run_id}}'
environment-id: 'Test'
environment-display-name: 'Test'
environment-type: 'testing'
- name: Confirm Jira Deploy Output
if: success()
run: |
echo "Jira Upload Deploy Info response: ${{steps.push_deployment_info_to_jira.outputs.response}}"
deploy_to_prod:
runs-on: ubuntu-latest
needs: build_and_test
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Deploy to Prod
run: |
echo "github.event_name: ${{github.event_name}}"
echo "github.ref: ${{github.ref}}"
echo "DEPLOY_STATE=successful" >> $GITHUB_ENV
echo "Deploying to Prod..."
- name: Failed Deployment
if: failure()
run: echo "DEPLOY_STATE=failed" >> $GITHUB_ENV
- name: Parse Jira Keys from All Commits
id: jira_keys
if: always()
uses: HighwayThree/jira-extract-issue-keys@master
with:
is-pull-request: ${{ github.event_name == 'pull_request' }}
parse-all-commits: ${{ github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Confirm Deploy State and Jira Key Values
if: always()
run: |
echo "DEPLOY_STATE: ${{env.DEPLOY_STATE}}"
echo "Jira Keys: ${{steps.jira_keys.outputs.jira-keys}}"
- name: Push Deployment Info to Jira
if: steps.jira_keys.outputs.jira-keys != ''
id: push_deployment_info_to_jira
uses: HighwayThree/jira-upload-deployment-info@master
with:
cloud-id: '${{ secrets.CLOUD_ID }}'
client-id: '${{ secrets.CLIENT_ID }}'
client-secret: '${{ secrets.CLIENT_SECRET }}'
deployment-sequence-number: '${{ github.run_id }}'
update-sequence-number: '${{ github.run_id }}'
issue-keys: "${{ steps.jira_keys.outputs.jira-keys }}"
display-name: "Deployment number asdf"
url: "${{github.event.repository.url}}/actions/runs/${{github.run_id}}"
description: "Prod Deployment"
last-updated: '${{github.event.head_commit.timestamp}}'
label: 'Prod Deployment Label'
state: '${{env.DEPLOY_STATE}}'
pipeline-id: '${{ github.repository }} ${{ github.workflow }}'
pipeline-display-name: 'Workflow: ${{ github.workflow }} (#${{ github.run_number }})'
pipeline-url: '${{github.event.repository.url}}/actions/runs/${{github.run_id}}'
environment-id: 'Prod'
environment-display-name: 'Prod'
environment-type: 'production'