forked from getgauge/gauge
-
Notifications
You must be signed in to change notification settings - Fork 0
248 lines (206 loc) · 7.04 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
name: Deploy
on: deployment
jobs:
package:
if: github.event.deployment.environment == 'production'
name: Create package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
- name: Compile gauge
run: go run build/make.go --all-platforms --skip-windows
- name: Create distro
run: |
go run build/make.go --distro --all-platforms --skip-windows
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: gauge-non-windows-artifact
path: ./deploy
windows-package:
needs: [package]
name: Create windows package
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
- name: Prep installer generation
shell: powershell
run: |
Start-Sleep -Milliseconds 1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest "https://sourceforge.net/projects/nsis/files/NSIS%203/3.06.1/nsis-3.06.1-strlen_8192.zip/download" -UseBasicParsing -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome -Outfile "./nsis.zip"
Expand-Archive -Force -LiteralPath ./nsis.zip -DestinationPath "C:\Program Files (x86)\NSIS\"
- name: Compile gauge
run: |
go run build/make.go --verbose --all-platforms
Get-ChildItem -Recurse .\bin
- name: Create Distro
shell: pwsh
run: |
go run build/make.go --distro --bin-dir bin\windows_amd64
go run build/make.go --distro --bin-dir bin\windows_386
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: gauge-windows-artifact
path: ./deploy
github-release:
name: Publish github release
runs-on: ubuntu-latest
needs: [windows-package]
env:
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}'
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v1
with:
name: gauge-non-windows-artifact
path: ./deploy
- uses: actions/download-artifact@v1
with:
name: gauge-windows-artifact
path: ./deploy
- name: update release note
run: |
cd deploy
version=$(ls gauge-*-linux.x86.zip | sed 's/gauge-//' | sed 's/-linux.*//')
if [ -z "$version" ]; then
echo "Gauge version is not set"
exit 1
fi
echo -e "Gauge v$version\n\n" > desc.txt
release_description=$(ruby -e "$(curl -sSfL https://github.com/getgauge/gauge/raw/master/build/create_release_text.rb)" getgauge gauge)
echo "$release_description" >> desc.txt
echo "Creating new draft for release v$version"
hub release create -F ./desc.txt "v$version"
echo "Start uploading artifacts"
for artifact in `ls gauge-*`; do
hub release edit -m "" -a $artifact v$version
done
cat desc.txt
rm -rf desc.txt
echo $version > ../version.txt
- name: upload gauge version
uses: actions/upload-artifact@v1
with:
name: gauge-version
path: ./version.txt
pypi-release:
runs-on: ubuntu-latest
needs: [github-release]
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Fetch gauge version
uses: actions/download-artifact@v1
with:
name: gauge-version
path: .
- name: Set gauge version
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
- name: Deploy to pypi
env:
PYPI_USER: ${{ secrets.PYPI_USER }}
GAUGE_PACKAGE_NAME: getgauge-cli
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
cd build/pip
pip install requests --user
python build.py --dist
pip install twine --user
gauge_package=`ls dist/$GAUGE_PACKAGE_NAME-$GAUGE_VERSION.tar.gz`
python -m twine upload -u $PYPI_USER -p $PYPI_PASSWORD $gauge_package
npm-release:
needs: [github-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- uses: actions/setup-node@v1
with:
node-version: '10.x'
registry-url: 'https://registry.npmjs.org'
- name: Fetch gauge version
uses: actions/download-artifact@v1
with:
name: gauge-version
path: .
- name: Set gauge version
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
- name: Setup Git User
run: |
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
- name: Deploy npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd build/npm
npm version $GAUGE_VERSION
npm publish --access=public
choco-release:
needs: [github-release]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- name: Fetch gauge version
uses: actions/download-artifact@v1
with:
name: gauge-version
path: .
- name: Set gauge version
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
shell: bash
- name: Clone chocolatey-packages
run: |
git clone https://github.com/getgauge/chocolatey-packages
- name: Deploy to Gauge $GAUGE_VERSION to choco
shell: pwsh
env:
API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
cd chocolatey-packages
$Env:GAUGE_VERSION | Set-Content version
cd gauge
./package.ps1
choco push "gauge.$Env:GAUGE_VERSION.nupkg" -k $Env:API_KEY
brew-release:
needs: [github-release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- name: Set up Ruby 2.6.x
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Fetch gauge version
uses: actions/download-artifact@v1
with:
name: gauge-version
path: .
- name: Set gauge version
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
- name: Update brew formula
env:
HOMEBREW_GITHUB_USER_NAME: ${{ secrets.HOMEBREW_GITHUB_USER_NAME }}
HOMEBREW_GITHUB_USER_EMAIL: ${{ secrets.HOMEBREW_GITHUB_USER_EMAIL }}
GITHUB_TOKEN: ${{ secrets.GAUGEBOT_GITHUB_TOKEN }}
run: |
cd build/brew
bash create_brew_pr.sh