-
Notifications
You must be signed in to change notification settings - Fork 344
274 lines (229 loc) · 7.83 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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
name: Deploy
on: deployment
permissions:
contents: read
jobs:
package:
if: github.event.deployment.environment == 'production'
name: Create package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
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@v4
with:
name: gauge-non-windows-artifact
path: ./deploy
windows-package:
name: Create windows package
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
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@v4
with:
name: gauge-windows-artifact
path: ./deploy
gauge-version:
name: Upload gauge version
runs-on: ubuntu-latest
needs: [package, windows-package]
env:
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: gauge-non-windows-artifact
path: ./deploy
- name: fetch gauge version
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 $version > ../version.txt
- name: upload gauge version
uses: actions/upload-artifact@v4
with:
name: gauge-version
path: ./version.txt
github-release:
runs-on: ubuntu-latest
needs: [gauge-version]
env:
GITHUB_TOKEN: '${{ secrets.GAUGEBOT_GITHUB_TOKEN }}'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: gauge-non-windows-artifact
path: ./deploy
- uses: actions/download-artifact@v4
with:
name: gauge-windows-artifact
path: ./deploy
- name: Fetch gauge version
uses: actions/download-artifact@v4
with:
name: gauge-version
path: .
- name: Set gauge version
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
- name: update release note
run: |
echo "---------------------------"
echo "Creating release v$version"
echo "---------------------------"
cd deploy
echo -e "Gauge v$GAUGE_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
gh release create --title "Gauge v$GAUGE_VERSION" --notes-file ./desc.txt "v$GAUGE_VERSION" ./gauge-*
pypi-release:
runs-on: ubuntu-latest
needs: [gauge-version]
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- name: Fetch gauge version
uses: actions/download-artifact@v4
with:
name: gauge-version
path: .
- name: Set gauge version
run: echo "GAUGE_VERSION=`cat version.txt`" >> $GITHUB_ENV
- name: Deploy to pypi
env:
GAUGE_PACKAGE_NAME: getgauge-cli
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
cd build/pip
pip install -r requirements.txt
python build.py --dist
gauge_package=`ls dist/$GAUGE_PACKAGE_NAME-$GAUGE_VERSION.tar.gz`
python -m twine upload --non-interactive $gauge_package
npm-release:
runs-on: ubuntu-latest
needs: [gauge-version]
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'build/npm/package-lock.json'
registry-url: 'https://registry.npmjs.org'
- name: Fetch gauge version
uses: actions/download-artifact@v4
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:
runs-on: windows-latest
needs: [gauge-version, windows-package]
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Fetch gauge version
uses: actions/download-artifact@v4
with:
name: gauge-version
path: .
- uses: actions/download-artifact@v4
with:
name: gauge-windows-artifact
path: ./deploy
- 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" --apikey=$Env:API_KEY --source=https://push.chocolatey.org/
brew-release:
runs-on: ubuntu-latest
needs: [gauge-version]
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow
- name: Set up Ruby 3.1.4
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.4
- name: Fetch gauge version
uses: actions/download-artifact@v4
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