Migrate to Speakeasy Workflows

Speakeasy is excited to present the release of workflow files. A workflow.yaml file allows you to define all relevant pieces of your SDK generation as consistent config in a single place. This new generation system is entirely portable. Generate your SDKs locally, from github, or from any CI system with complete consistency.

If you have an existing Speakeasy SDK in Github we've setup an easy migration tool for you. Navigate to the root of your repo and run the following command.


speakeasy migrate

You should see the following changes as a result:

  • .speakeasy/workflow.yaml [NEW]
  • .github/workflows/sdk_generation_action.yaml [UPDATED]

Push these changes up and you are ready to go! The produced files should look something like the following.

.github/workflows/sdk_generation_action.yaml

name: Generate
permissions:
checks: write
contents: write
pull-requests: write
statuses: write
"on":
workflow_dispatch:
inputs:
force:
description: Force generation of SDKs
type: boolean
default: false
schedule:
- cron: 0 0 * * *
jobs:
generate:
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
with:
force: ${{ github.event.inputs.force }}
mode: pr
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

.speakeasy/workflow.yaml

workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
openapi:
inputs:
- location: https://raw.githubusercontent.com/speakeasy-sdks/template-speakeasy-bar/main/openapi.yaml
targets:
my-target:
target: typescript
source: openapi

You can now generate your SDK locally using speakeasy run while github actions automated generations will continue working as they did before.

If you have any custom code in your current github action workflow it should automatically be moved over by the migration script. If you have any issues here don't hesistate to reach out the Speakeasy team over slack and we will help you get it resolved quickly.

Creating a new SDK repo

If you would prefer to migrate by creating a new SDK repo we have an easy to use command to setup an SDK for your preferred spec and language. Simply create a new repo and run the following commands from the root directory.


speakeasy quickstart
speakeasy configure github

After your repo is created copy the gen.yaml from your old SDK into .speakeasy/gen.yaml in your new SDK repo. You're ready to generate!