-
Notifications
You must be signed in to change notification settings - Fork 6
692 lines (688 loc) · 30.2 KB
/
workflow-executor.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
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
name: Speakeasy SDK Generation Workflow
on:
workflow_call:
inputs:
runs-on:
description: The GitHub Action Runner
default: ubuntu-22.04
required: false
type: string
speakeasy_version:
description: The version of the Speakeasy CLI to use or "latest" [DEPRECATED]
default: latest
required: false
type: string
mode:
description: |-
The mode to run the workflow in, valid options are 'direct' or 'pr', defaults to 'direct'.
- 'direct' will create a commit with the changes to the SDKs and push them directly to the branch the workflow is configure to run on (normally 'main' or 'master').
If publishing and creating a release are configured this will happen immediately after the commit is created on the branch.
- 'pr' will instead create a new branch to commit the changes to the SDKs to and then create a PR from this branch.
The sdk-publish workflow will then need to be configured to run when the PR is merged to publish the SDKs and create a release.
See documentation for more details.
default: "direct"
required: false
type: string
target:
description: "Generate a specific target by name"
required: false
type: string
force:
description: "Force the generation of the SDKs"
default: "false"
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
registry_tags:
description: "Multi-line or single-line string input of tags to apply to speakeasy registry builds"
required: false
type: string
push_code_samples_only:
description: "This will generate code samples, tag them with the `main` branch name, and push them to the registry. It will not create a pull request or commit any code. This is useful for pushing up some code samples to the registry the first time when there are no code samples in the registry."
required: false
type: boolean
set_version:
description: "Version to manually set for SDK generation"
required: false
type: string
environment:
description: |
Any required environment variables to set for the speakeasy run execution. Set as a string with each entry of the form "key=value".
Example:
environment: |
SPECIFICATION_URL=https://api.example.com/swagger.json
Where .speakeasy/workflow.yaml contains:
sources:
my-source:
inputs:
- location: $SPECIFICATION_URL
Note: This should not be used for secrets as inputs will *not* be masked. Something akin to $npm_token should be explicitly passed as a secret.
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"
pnpm_version:
description: "Version of pnpm to install. Not recommended for use without consulting Speakeasy support."
required: false
type: string
poetry_version:
description: "Version of poetry to install. Not recommended for use without consulting Speakeasy support."
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
openapi_doc_auth_token:
description: The auth token to use when fetching the OpenAPI document if it is not publicly hosted. For example `Bearer <token>` or `<token>`.
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
slack_webhook_url:
description: A Slack webhook URL that pipeline failures will be posted to
required: false
terraform_gpg_secret_key:
description: The GPG secret key to use for signing the Terraform provider
required: false
terraform_gpg_passphrase:
description: The passphrase for the Terraform GPG secret key
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 the Nuget registry
required: false
jobs:
run-workflow:
name: Generate Target
runs-on: ${{ inputs.runs-on }}
outputs:
commit_hash: ${{ steps.run-workflow.outputs.commit_hash }}
publish_python: ${{ steps.run-workflow.outputs.publish_python }}
publish_typescript: ${{ steps.run-workflow.outputs.publish_typescript }}
publish_terraform: ${{ steps.run-workflow.outputs.publish_terraform }}
publish_java: ${{ steps.run-workflow.outputs.publish_java }}
publish_php: ${{ steps.run-workflow.outputs.publish_php }}
publish_ruby: ${{ steps.run-workflow.outputs.publish_ruby }}
publish_csharp: ${{ steps.run-workflow.outputs.publish_csharp }}
python_regenerated: ${{ steps.run-workflow.outputs.python_regenerated }}
python_directory: ${{ steps.run-workflow.outputs.python_directory }}
typescript_regenerated: ${{ steps.run-workflow.outputs.typescript_regenerated }}
typescript_directory: ${{ steps.run-workflow.outputs.typescript_directory }}
go_regenerated: ${{ steps.run-workflow.outputs.go_regenerated }}
go_directory: ${{ steps.run-workflow.outputs.go_directory }}
terraform_regenerated: ${{ steps.run-workflow.outputs.terraform_regenerated }}
terraform_directory: ${{ steps.run-workflow.outputs.terraform_directory }}
java_regenerated: ${{ steps.run-workflow.outputs.java_regenerated }}
java_directory: ${{ steps.run-workflow.outputs.java_directory }}
php_regenerated: ${{ steps.run-workflow.outputs.php_regenerated }}
php_directory: ${{ steps.run-workflow.outputs.php_directory }}
ruby_regenerated: ${{ steps.run-workflow.outputs.ruby_regenerated }}
ruby_directory: ${{ steps.run-workflow.outputs.ruby_directory }}
csharp_regenerated: ${{ steps.run-workflow.outputs.csharp_regenerated }}
csharp_directory: ${{ steps.run-workflow.outputs.csharp_directory }}
swift_regenerated: ${{ steps.run-workflow.outputs.swift_regenerated }}
swift_directory: ${{ steps.run-workflow.outputs.swift_directory }}
unity_regenerated: ${{ steps.run-workflow.outputs.unity_regenerated }}
unity_directory: ${{ steps.run-workflow.outputs.unity_directory }}
docs_regenerated: ${{ steps.run-workflow.outputs.docs_regenerated }}
docs_directory: ${{ steps.run-workflow.outputs.docs_directory }}
branch_name: ${{ steps.run-workflow.outputs.branch_name }}
resolved_speakeasy_version: ${{ steps.run-workflow.outputs.resolved_speakeasy_version }}
use_sonatype_legacy: ${{ steps.run-workflow.outputs.use_sonatype_legacy }}
short_circuit_label_trigger: ${{ steps.check-label.outputs.short_circuit_label_trigger }}
steps:
- name: Check Pull Request Label
if: ${{ github.event_name == 'pull_request' && (github.event.action == 'labeled' || github.event.action == 'unlabeled') }}
id: check-label
continue-on-error: true
run: |
label="${{ github.event.label.name }}"
tmpfile=$(mktemp)
echo "${{ github.event.pull_request.body }}" > "$tmpfile"
# Check if the label is a valid version bump and ensure the current PR isn't already on that version bump
# If either are true we short circuit the rest of the action
if [[ "$label" != "patch" && "$label" != "minor" && "$label" != "major" && "$label" != "graduate" ]] || { [[ "${{ github.event.action }}" == "labeled" ]] && grep -Fq "Version Bump Type: [$label]" "$tmpfile"; }; then
echo "No version bump label found in PR body. Short-circuiting."
echo "short_circuit_label_trigger=true" >> "$GITHUB_OUTPUT"
exit 0
else
echo "short_circuit_label_trigger=false" >> "$GITHUB_OUTPUT"
fi
- name: Tune GitHub-hosted runner network
if: ${{ steps.check-label.outputs.short_circuit_label_trigger != 'true' }}
uses: smorimoto/tune-github-hosted-runner-network@v1
- id: run-workflow
name: Run Generation Workflow
if: ${{ steps.check-label.outputs.short_circuit_label_trigger != 'true' }}
uses: speakeasy-api/sdk-generation-action@v15
with:
speakeasy_version: ${{ inputs.speakeasy_version }}
github_access_token: ${{ secrets.github_access_token }}
mode: ${{ inputs.mode }}
force: ${{ inputs.force }}
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
output_tests: ${{ inputs.output_tests }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
working_directory: ${{ inputs.working_directory }}
openapi_doc_auth_token: ${{ secrets.openapi_doc_auth_token }}
target: ${{ inputs.target }}
registry_tags: ${{ inputs.registry_tags }}
push_code_samples_only: ${{ inputs.push_code_samples }}
set_version: ${{ inputs.set_version }}
cli_environment_variables: ${{ inputs.environment }}
pnpm_version: ${{ inputs.pnpm_version }}
poetry_version: ${{ inputs.poetry_version }}
- uses: ravsamhq/notify-slack-action@v2
if: ${{ steps.check-label.outputs.short_circuit_label_trigger != 'true' && env.SLACK_WEBHOOK_URL != '' }}
with:
status: ${{ job.status }}
token: ${{ secrets.github_access_token }}
notify_when: "failure"
notification_title: "SDK Generation 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
name: Log Generation Output
uses: speakeasy-api/sdk-generation-action@v15
if: ${{ steps.check-label.outputs.short_circuit_label_trigger != 'true'}}
with:
speakeasy_version: ${{ inputs.speakeasy_version }}
github_access_token: ${{ secrets.github_access_token }}
working_directory: ${{ inputs.working_directory }}
action: log-result
speakeasy_api_key: ${{ secrets.speakeasy_api_key }}
speakeasy_server_url: ${{ inputs.speakeasy_server_url }}
env:
GH_ACTION_RESULT: ${{ job.status }}
RESOLVED_SPEAKEASY_VERSION: ${{ steps.run-workflow.outputs.resolved_speakeasy_version }}
GH_ACTION_VERSION: "v15"
GH_ACTION_STEP: ${{ github.job }}
publish-pypi:
if: ${{ always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.run-workflow.outputs.python_regenerated == 'true' &&
needs.run-workflow.outputs.publish_python == 'true'
&& inputs.mode != 'pr' }}
name: Publish Python SDK
runs-on: ${{ inputs.runs-on }}
needs: [run-workflow]
defaults:
run:
working-directory: ${{ needs.run-workflow.outputs.python_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v3
with:
ref: ${{ needs.run-workflow.outputs.commit_hash }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry --version
env:
POETRY_VERSION: ${{ inputs.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.run-workflow.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: "Publishing of Python 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:
speakeasy_version: ${{ inputs.speakeasy_version }}
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: ${{ always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.run-workflow.outputs.typescript_regenerated == 'true' &&
needs.run-workflow.outputs.publish_typescript == 'true'
&& inputs.mode != 'pr' }}
name: Publish Typescript SDK
runs-on: ${{ inputs.runs-on }}
needs: [run-workflow]
defaults:
run:
working-directory: ${{ needs.run-workflow.outputs.typescript_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v3
with:
ref: ${{ needs.run-workflow.outputs.commit_hash }}
- 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.run-workflow.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: "Publishing of Typescript 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:
speakeasy_version: ${{ inputs.speakeasy_version }}
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: ""
GH_ACTION_STEP: ${{ github.job }}
TARGET_TYPE: "sdk"
publish-java:
if: ${{ always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.run-workflow.outputs.java_regenerated == 'true' &&
needs.run-workflow.outputs.publish_java == 'true'
&& inputs.mode != 'pr' }}
name: Publish Java SDK
runs-on: ${{ inputs.runs-on }}
needs: [run-workflow]
defaults:
run:
working-directory: ${{ needs.run-workflow.outputs.java_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v3
with:
ref: ${{ needs.run-workflow.outputs.commit_hash }}
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "corretto"
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Publish to Sonatype (legacy)
if: ${{ needs.run-workflow.outputs.use_sonatype_legacy == 'true' }}
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: publish
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
if: ${{ needs.run-workflow.outputs.use_sonatype_legacy != 'true' }}
run: |-
pwd
./gradlew build sonatypeCentralUpload --no-daemon
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.run-workflow.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: "Publishing of Java 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:
speakeasy_version: ${{ inputs.speakeasy_version }}
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: ${{ always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.run-workflow.outputs.ruby_regenerated == 'true' &&
needs.run-workflow.outputs.publish_ruby == 'true'
&& inputs.mode != 'pr' }}
name: Publish Ruby SDK
runs-on: ${{ inputs.runs-on }}
needs: [run-workflow]
defaults:
run:
working-directory: ${{ needs.run-workflow.outputs.ruby_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v3
with:
ref: ${{ needs.run-workflow.outputs.commit_hash }}
- 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.run-workflow.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:
speakeasy_version: ${{ inputs.speakeasy_version }}
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: ${{ always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.run-workflow.outputs.csharp_regenerated == 'true' &&
needs.run-workflow.outputs.publish_csharp == 'true'
&& inputs.mode != 'pr' }}
name: Publish C# SDK
runs-on: ${{ inputs.runs-on }}
needs: [run-workflow]
defaults:
run:
working-directory: ${{ needs.run-workflow.outputs.csharp_directory }}
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v3
with:
ref: ${{ needs.run-workflow.outputs.commit_hash }}
- 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.run-workflow.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:
speakeasy_version: ${{ inputs.speakeasy_version }}
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: ${{ always() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled') &&
needs.run-workflow.outputs.php_regenerated == 'true' &&
needs.run-workflow.outputs.publish_php == 'true'
&& inputs.mode != 'pr' }}
name: Publish PHP SDK
runs-on: ${{ inputs.runs-on }}
needs: [run-workflow]
defaults:
run:
working-directory: ${{ needs.run-workflow.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.run-workflow.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: "Publishing of PHP 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:
speakeasy_version: ${{ inputs.speakeasy_version }}
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"