Migrate to Speakeasy Workflows

The workflow.yaml file allows you to define all the 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 absolute consistency.

Who Needs to Migrate?

If you have been using Speakeasy since before March 2024, follow the steps below to migrate to workflows. Customers who started with Speakeasy in March 2024 or later are likely already using Speakeasy workflows.

If a .speakeasy folder is present in your generated SDK, you are already using workflows.

Migration Steps

If you have an existing Speakeasy SDK in GitHub, we’ve set up 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 previously.

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 migrating to workflows, reach out to the Speakeasy team on Slack and we will help you resolve it quickly.

Creating a New SDK Repo

If you prefer to migrate by creating a new SDK repo, we have an easy-to-use command to set up an SDK for your preferred spec and language.

Create a new repo and run the following commands from the root directory:

speakeasy quickstart
speakeasy configure github

Once 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!