-
Notifications
You must be signed in to change notification settings - Fork 6
610 lines (609 loc) · 25.4 KB
/
sdk-publish.yaml
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
name: Speakeasy SDK Publish Workflow
on:
workflow_call:
inputs:
runs-on:
description: The GitHub Action Runner
default: ubuntu-22.04
required: false
type: string
speakeasy_server_url:
required: false
description: "Internal use only"
type: string
working_directory:
description: "The working directory for running Speakeasy CLI commands in the action"
required: false
type: string
dotnet_version:
description: "The version of dotnet to use when compiling the C# SDK"
required: false
type: string
default: "5.x"
target:
description: "The specific target to publish"
required: false
type: string
secrets:
github_access_token:
description: A GitHub access token with write access to the repo
required: true
pypi_token:
description: A PyPi access token for publishing the package to PyPi, include the `pypi-` prefix
required: false
npm_token:
description: An NPM access token for publishing the package to NPM, include the `npm_` prefix
required: false
packagist_username:
description: A Packagist username for publishing the package to Packagist
required: false
packagist_token:
description: A Packagist API token for publishing the package to Packagist
required: false
speakeasy_api_key:
description: The API key to use to authenticate the Speakeasy CLI
required: true
ossrh_username:
description: A username for publishing the Java package to the OSSRH URL provided in gen.yml
required: false
ossrh_password:
description: The corresponding password for publishing the Java package to the OSSRH URL provided in gen.yml
required: false
java_gpg_secret_key:
description: The GPG secret key to use for signing the Java package
required: false
java_gpg_passphrase:
description: The passphrase for the GPG secret key
required: false
terraform_gpg_secret_key:
description: The GPG secret key to use for signing the Terraform Provider binary
required: false
terraform_gpg_passphrase:
description: The passphrase for the associated terraform provider key
required: false
slack_webhook_url:
description: A Slack webhook URL that pipeline failures will be posted to
required: false
rubygems_auth_token:
description: The auth token (api key) for publishing to RubyGems
required: false
nuget_api_key:
description: The api key for publishing to Nuget
required: false
jobs:
release:
name: Create Github Release
runs-on: ${{ inputs.runs-on }}
outputs:
publish_python: ${{ steps.release.outputs.publish_python }}
publish_typescript: ${{ steps.release.outputs.publish_typescript }}
publish_terraform: ${{ steps.release.outputs.publish_terraform }}
publish_java: ${{ steps.release.outputs.publish_java }}
publish_php: ${{ steps.release.outputs.publish_php }}
publish_ruby: ${{ steps.release.outputs.publish_ruby }}
publish_csharp: ${{ steps.release.outputs.publish_csharp }}
python_regenerated: ${{ steps.release.outputs.python_regenerated }}
python_directory: ${{ steps.release.outputs.python_directory }}
typescript_regenerated: ${{ steps.release.outputs.typescript_regenerated }}
typescript_directory: ${{ steps.release.outputs.typescript_directory }}
terraform_regenerated: ${{ steps.release.outputs.terraform_regenerated }}
terraform_directory: ${{ steps.release.outputs.terraform_directory }}
go_regenerated: ${{ steps.release.outputs.go_regenerated }}
go_directory: ${{ steps.release.outputs.go_directory }}
java_regenerated: ${{ steps.release.outputs.java_regenerated }}
java_directory: ${{ steps.release.outputs.java_directory }}
php_regenerated: ${{ steps.release.outputs.php_regenerated }}
php_directory: ${{ steps.release.outputs.php_directory }}
ruby_regenerated: ${{ steps.release.outputs.ruby_regenerated }}
ruby_directory: ${{ steps.release.outputs.ruby_directory }}
csharp_regenerated: ${{ steps.release.outputs.csharp_regenerated }}
csharp_directory: ${{ steps.release.outputs.csharp_directory }}
swift_regenerated: ${{ steps.release.outputs.swift_regenerated }}
swift_directory: ${{ steps.release.outputs.swift_directory }}
use_sonatype_legacy: ${{ steps.release.outputs.use_sonatype_legacy }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- id: release
uses: speakeasy-api/sdk-generation-action@v15
with:
github_access_token: ${{ secrets.github_access_token }}
action: "release"
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
target: ${{ inputs.target }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
- uses: ravsamhq/notify-slack-action@v2
if: always() && env.SLACK_WEBHOOK_URL != ''
with:
status: ${{ job.status }}
token: ${{ secrets.github_access_token }}
notify_when: "failure"
notification_title: "Failed to create Github Release"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- id: log-result
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: log-result
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
GH_ACTION_STEP: ${{ github.job }}
TARGET_TYPE: "sdk"
publish-pypi:
if: ${{ needs.release.outputs.python_regenerated == 'true' && needs.release.outputs.publish_python == 'true' }}
name: Publish Python SDK
runs-on: ${{ inputs.runs-on }}
needs: release
defaults:
run:
working-directory: ${{ needs.release.outputs.python_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.3 python3 -
poetry --version
- name: Check for publish.sh
id: check-publish
run: |
if [ -f scripts/publish.sh ]; then
echo "publish_with_script=true" >> $GITHUB_OUTPUT
fi
- name: Publish with script
if: steps.check-publish.outputs.publish_with_script == 'true'
env:
PYPI_TOKEN: ${{ secrets.pypi_token }}
run: |
./scripts/publish.sh
- name: Legacy publish
if: steps.check-publish.outputs.publish_with_script != 'true'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*
- id: publish-event
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: publish-event
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
target_directory: ${{ needs.release.outputs.python_directory }}
registry_name: "pypi"
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
- uses: ravsamhq/notify-slack-action@v2
if: always() && env.SLACK_WEBHOOK_URL != ''
with:
status: ${{ job.status }}
token: ${{ secrets.github_access_token }}
notify_when: "failure"
notification_title: "Failed to publish Python SDK"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- id: log-result
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: log-result
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
GH_ACTION_STEP: ${{ github.job }}
TARGET_TYPE: "sdk"
publish-npm:
if: ${{ needs.release.outputs.typescript_regenerated == 'true' && needs.release.outputs.publish_typescript == 'true' }}
name: Publish Typescript SDK
runs-on: ${{ inputs.runs-on }}
needs: release
defaults:
run:
working-directory: ${{ needs.release.outputs.typescript_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm install
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
run: npm publish --access public
- id: publish-event
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: publish-event
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
target_directory: ${{ needs.release.outputs.typescript_directory }}
registry_name: "npm"
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
- uses: ravsamhq/notify-slack-action@v2
if: always() && env.SLACK_WEBHOOK_URL != ''
with:
status: ${{ job.status }}
token: ${{ secrets.github_access_token }}
notify_when: "failure"
notification_title: "Failed to publish Typescript SDK"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- id: log-result
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: log-result
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
GH_ACTION_STEP: ${{ github.job }}
TARGET_TYPE: "sdk"
publish-java:
if: ${{ needs.release.outputs.java_regenerated == 'true' && needs.release.outputs.publish_java == 'true' }}
name: Publish Java SDK
runs-on: ${{ inputs.runs-on }}
needs: release
defaults:
run:
working-directory: ${{ needs.release.outputs.java_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "corretto"
cache: "gradle"
- name: Publish to Sonatype (legacy)
run: |-
pwd
./gradlew publish --no-daemon
if: ${{ needs.release.outputs.use_sonatype_legacy == 'true' }}
env:
MAVEN_USERNAME: ${{ secrets.ossrh_username }}
MAVEN_PASSWORD: ${{ secrets.ossrh_password }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.java_gpg_secret_key }}
ORG_GRADLE_PROJECT_signingPassphrase: ${{ secrets.java_gpg_passphrase }}
- name: Publish to Sonatype Central
run: |-
pwd
./gradlew build sonatypeCentralUpload --no-daemon
if: ${{ needs.release.outputs.use_sonatype_legacy != 'true' }}
env:
SONATYPE_USERNAME: ${{ secrets.ossrh_username }}
SONATYPE_PASSWORD: ${{ secrets.ossrh_password }}
SONATYPE_SIGNING_KEY: ${{ secrets.java_gpg_secret_key }}
SIGNING_KEY_PASSPHRASE: ${{ secrets.java_gpg_passphrase }}
- id: publish-event
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: publish-event
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
target_directory: ${{ needs.release.outputs.java_directory }}
registry_name: "sonatype"
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
- uses: ravsamhq/notify-slack-action@v2
if: always() && env.SLACK_WEBHOOK_URL != ''
with:
status: ${{ job.status }}
token: ${{ secrets.github_access_token }}
notify_when: "failure"
notification_title: "Failed to publish Java SDK"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- id: log-result
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: log-result
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
GH_ACTION_STEP: ${{ github.job }}
TARGET_TYPE: "sdk"
publish-packagist:
if: ${{ needs.release.outputs.php_regenerated == 'true' && needs.release.outputs.publish_php == 'true' }}
name: Publish PHP SDK
runs-on: ${{ inputs.runs-on }}
needs: release
defaults:
run:
working-directory: ${{ needs.release.outputs.php_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- name: Publish
uses: speakeasy-api/packagist-update@support-github-creation
with:
username: ${{ secrets.packagist_username }}
api_token: ${{ secrets.packagist_token }}
package_name: ${{ github.repository }}
package_base_url: ${{ github.server_url }}
- id: publish-event
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: publish-event
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
target_directory: ${{ needs.release.outputs.php_directory }}
registry_name: "packagist"
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
- uses: ravsamhq/notify-slack-action@v2
if: always() && env.SLACK_WEBHOOK_URL != ''
with:
status: ${{ job.status }}
token: ${{ secrets.github_access_token }}
notify_when: "failure"
notification_title: "Failed to publish PHP SDK"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- id: log-result
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: log-result
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
GH_ACTION_STEP: ${{ github.job }}
TARGET_TYPE: "sdk"
publish-nuget:
if: ${{ needs.release.outputs.csharp_regenerated == 'true' && needs.release.outputs.publish_csharp == 'true' }}
name: Publish C# SDK
runs-on: ${{ inputs.runs-on }}
needs: release
defaults:
run:
working-directory: ${{ needs.release.outputs.csharp_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ inputs.dotnet_version }}
- name: Publish
run: dotnet pack -c Release -o . && dotnet nuget push *.nupkg --api-key ${{ secrets.nuget_api_key }} --source https://api.nuget.org/v3/index.json
- id: publish-event
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: publish-event
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
target_directory: ${{ needs.release.outputs.csharp_directory }}
registry_name: "nuget"
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
- uses: ravsamhq/notify-slack-action@v2
if: always() && env.SLACK_WEBHOOK_URL != ''
with:
status: ${{ job.status }}
token: ${{ secrets.github_access_token }}
notify_when: "failure"
notification_title: "Publishing of C# SDK Failed"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- id: log-result
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: log-result
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
GH_ACTION_STEP: ${{ github.job }}
TARGET_TYPE: "sdk"
publish-terraform:
if: ${{ needs.release.outputs.terraform_regenerated == 'true' && needs.release.outputs.publish_terraform == 'true' }}
name: Publish Terraform Provider
runs-on: ${{ inputs.runs-on }}
needs: release
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
install-only: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.terraform_gpg_secret_key }}
passphrase: ${{ secrets.terraform_gpg_passphrase }}
- id: release
uses: speakeasy-api/sdk-generation-action@v15
with:
github_access_token: ${{ secrets.github_access_token }}
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
gpg_fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}
action: "release"
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
env:
GITHUB_TOKEN: ${{ secrets.github_access_token }}
- id: publish-event
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: publish-event
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
target_directory: ${{ needs.release.outputs.publish_terraform }}
registry_name: "terraform"
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
- uses: ravsamhq/notify-slack-action@v2
if: always() && env.SLACK_WEBHOOK_URL != ''
with:
status: ${{ job.status }}
token: ${{ secrets.github_access_token }}
notify_when: "failure"
notification_title: "Publishing of Terraform Provider Failed"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- id: log-result
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: log-result
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
GH_ACTION_STEP: ${{ github.job }}
TARGET_TYPE: "sdk"
publish-gems:
if: ${{ needs.release.outputs.ruby_regenerated == 'true' && needs.release.outputs.publish_ruby == 'true' }}
name: Publish Ruby SDK
runs-on: ${{ inputs.runs-on }}
needs: release
defaults:
run:
working-directory: ${{ needs.release.outputs.ruby_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: "3.1"
- name: Install dependencies
run: gem build && bundle install && rake rubocop
- name: Publish
env:
GEM_HOST_API_KEY: ${{ secrets.rubygems_auth_token }}
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
- id: publish-event
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: publish-event
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
target_directory: ${{ needs.release.outputs.ruby_directory }}
registry_name: "gems"
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
- uses: ravsamhq/notify-slack-action@v2
if: always() && env.SLACK_WEBHOOK_URL != ''
with:
status: ${{ job.status }}
token: ${{ secrets.github_access_token }}
notify_when: "failure"
notification_title: "Publishing of Ruby SDK Failed"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- id: log-result
uses: speakeasy-api/sdk-generation-action@v15
if: always()
with:
github_access_token: ${{ secrets.github_access_token }}
action: log-result
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
working_directory: ${{ inputs.working_directory }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
env:
GH_ACTION_RESULT: ${{ job.status }}
GH_ACTION_VERSION: "v15"
GH_ACTION_STEP: ${{ github.job }}
TARGET_TYPE: "sdk"