-
Notifications
You must be signed in to change notification settings - Fork 79
180 lines (178 loc) · 6.95 KB
/
release.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
169
170
171
172
173
174
175
176
177
178
179
180
name: Cli Release
on:
workflow_dispatch:
inputs:
change-log:
description: 'Open API Changelog.'
version-type:
description: 'Version to upgrade, Major: 0, Minor:1, Patch: 2'
homebrew-branch:
description: 'HomeBrew branch name'
default: main
homebrew-prerelease:
description: 'HomeBrew prerelease'
default: 'false'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 16.x, 14.x]
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- run: make install
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Run tests
run: npm test
update-api-definitions-changelog:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout cli
uses: actions/checkout@v2
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Update Changelog
run: |
bash .github/scripts/commit-api-spec-change-log.sh "${{ github.event.inputs.change-log }}" ${{ github.event.inputs.version-type }}
release:
runs-on: ubuntu-latest
needs: [update-api-definitions-changelog]
outputs:
tag-name: ${{ steps.semantic-release.outputs.TAG_NAME }}
draft-tag-name: ${{ steps.semantic-release-draft.outputs.TAG_NAME }}
steps:
- name: Checkout cli
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Run git and npm update
run: |
git pull
make install
- name: Semantic Release runs
id: semantic-release
run: DEBUG=semantic-release:* npx semantic-release -t \${version}
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: verify release required
if: ${{steps.semantic-release.outputs.TAG_NAME == ''}}
uses: actions/github-script@v3
with:
script: |
core.setFailed('There are no relevant changes, so no new version is released.')
- name: Update release
run: node .github/scripts/update-release.js
env:
TAG_NAME: ${{steps.semantic-release.outputs.TAG_NAME}}
RELEASE_BODY: ${{github.event.inputs.change-log}}
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUTS: '{ "tag-name": "${{needs.release.outputs.draft-tag-name}}" }'
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
oclif-release:
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- run: |
git pull
make install
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Invoke Oclif workflow
if: ${{needs.release.outputs.tag-name != '' && steps.extract_branch.outputs.branch == 'main'}}
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: 'oclif-release.yml'
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
INPUTS: '{ "home-brew-branch": "${{github.event.inputs.homebrew-branch}}", "tag-name": "${{needs.release.outputs.tag-name}}", "pre-release": "${{github.event.inputs.homebrew-prerelease}}"}'
- name: Invoke Oclif workflow for release candidate
if: ${{needs.release.outputs.tag-name != '' && steps.extract_branch.outputs.branch != 'main'}}
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: 'oclif-release.yml'
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
INPUTS: '{ "home-brew-branch": "${{github.event.inputs.homebrew-branch}}", "tag-name": "${{needs.release.outputs.tag-name}}", "formula": "twiliorc", "pre-release": "${{github.event.inputs.homebrew-prerelease}}"}'
docker-release:
runs-on: ubuntu-latest
needs: [ release ]
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- run: |
git pull
make install
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Invoke Docker workflow
if: ${{needs.release.outputs.tag-name != ''}}
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: 'docker-release.yml'
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
- name: Run acceptance testing for docker release
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: '.github/workflows/cli-test-docker.yml'
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
platform-executables-release:
runs-on: ubuntu-latest
needs: [ release ]
env:
REPO_NAME: ${{ github.repository }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
strategy:
matrix:
executable_workflow: ['debian-executable-release.yml', 'macos-executable-release.yml', 'rpmbuild.yml', 'windows-executable-release.yml', 'apt-release.yml']
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- run: |
git pull
make install
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Invoke platform executable workflow
if: ${{needs.release.outputs.tag-name != '' && steps.extract_branch.outputs.branch == 'main'}}
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: ${{ matrix.executable_workflow }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
notify-complete-fail:
if: ${{ failure() || cancelled() }}
needs: [ release, oclif-release, platform-executables-release ]
name: Notify Release Failed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.ALERT_SLACK_WEB_HOOK }}
SLACK_COLOR: "#ff3333"
SLACK_USERNAME: CLI Release Bot
SLACK_ICON_EMOJI: ":ship:"
SLACK_TITLE: "Twilio Cli"
SLACK_MESSAGE: 'CLI Release workflow Failed'