Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autorelease #357

Merged
merged 18 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/create-sdk-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: create-sdk-releases

on:
workflow_dispatch:
inputs:
bump_type:
description: 'The type of version bump to make'
required: true
type: choice
options:
- 'major'
- 'minor'
- 'patch'
language:
billytrend-cohere marked this conversation as resolved.
Show resolved Hide resolved
description: 'If you want to just release a specific language'
required: true
type: choice
options:
- 'go'
- 'java'
- 'python'
- 'typescript'
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install Dependencies
shell: bash
run: pnpm install

- name: Run snippet tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_OWNER: ${{ github.repository_owner }}
GITHUB_REPO: ${{ github.event.repository.name }}
BUMP_TYPE: ${{ github.event.inputs.bump_type }}
run: pnpm run --filter autorelease release
33 changes: 33 additions & 0 deletions .github/workflows/delete-n-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: delete-n-releases

on:
workflow_dispatch:
inputs:
n:
description: 'Number of releases to delete'
required: true
default: "1"

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install Dependencies
shell: bash
run: pnpm install

- name: Run snippet tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_OWNER: ${{ github.repository_owner }}
GITHUB_REPO: ${{ github.event.repository.name }}
N_VERSIONS: ${{ github.event.inputs.n }}
run: pnpm run --filter autorelease delete
127 changes: 127 additions & 0 deletions .github/workflows/release-sdks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: release-sdks

on: [push]

jobs:
fern-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install Dependencies
shell: bash
run: pnpm install

- name: Run fern check
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: pnpm run docs:check

fern-generate-node:
environment: sdk-release
needs: fern-check
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/node@')
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3

- name: Download Fern
run: npm install -g fern-api

- name: Release TypeScript SDK
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
tag=${{ github.ref_name }}
prefix="node@"
SDK_VERSION="${tag#$prefix}"
fern generate --group node-sdk --version "$SDK_VERSION" --log-level debug

fern-generate-go:
environment: sdk-release
needs: fern-check
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/go@')
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3

- name: Download Fern
run: npm install -g fern-api

- name: Release Go SDK
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
tag=${{ github.ref_name }}
prefix="go@"
SDK_VERSION="${tag#$prefix}"
fern generate --group go-sdk --version "$SDK_VERSION" --log-level debug

fern-generate-java:
environment: sdk-release
needs: fern-check
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/java@')
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3

- name: Download Fern
run: npm install -g fern-api

- name: Release Java SDK
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_CENTRAL_SECRET_KEY_KEY_ID: ${{ secrets.MAVEN_CENTRAL_SECRET_KEY_KEY_ID }}
MAVEN_CENTRAL_SECRET_KEY_PASSWORD: ${{ secrets.MAVEN_CENTRAL_SECRET_KEY_PASSWORD }}
MAVEN_CENTRAL_SECRET_KEY: ${{ secrets.MAVEN_CENTRAL_SECRET_KEY }}
run: |
tag=${{ github.ref_name }}
prefix="java@"
SDK_VERSION="${tag#$prefix}"
fern generate --group java-sdk --version "$SDK_VERSION" --log-level debug

fern-generate-python:
environment: sdk-release
needs: fern-check
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/python@')
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3

- name: Download Fern
run: npm install -g fern-api

- name: Release Python SDK
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
tag=${{ github.ref_name }}
prefix="python@"
SDK_VERSION="${tag#$prefix}"
fern generate --group python-sdk --version "$SDK_VERSION" --log-level debug
142 changes: 142 additions & 0 deletions fern/apis/sdks/generators.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
api:
path: ../../../cohere-openapi.yaml
groups:
node-sdk:
audiences:
- public
- v2-beta
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.44.1
output:
location: npm
package-name: cohere-ai
token: ${NPM_TOKEN}
github:
repository: cohere-ai/cohere-typescript
mode: pull-request
config:
allowCustomFetcher: true
defaultTimeoutInSeconds: 300
namespaceExport: Cohere
skipResponseValidation: true
allowExtraFields: true
extraDevDependencies:
jest: "^29.7.0"
ts-jest: "^29.1.2"
"@types/readable-stream": ^4.0.14
"ts-loader": "^9.5.1"
"webpack": "^5.91.0"
"@types/convict": "^6.1.6"
extraDependencies:
readable-stream: ^4.5.2
"@aws-sdk/client-sagemaker": "^3.583.0"
"@aws-sdk/credential-providers": "^3.583.0"
"@aws-sdk/protocol-http": "^3.374.0"
"@aws-sdk/signature-v4": "^3.374.0"
"convict": "^6.2.4"

go-sdk:
audiences:
- public
- v2-beta
generators:
- name: fernapi/fern-go-sdk
version: 0.35.1
github:
repository: cohere-ai/cohere-go
mode: pull-request
config:
union: v1
includeLegacyClientOptions: true
java-sdk:
audiences:
- public
- v2-beta
generators:
- name: fernapi/fern-java-sdk
version: 2.7.0
publish-metadata:
author: "cohere"
email: "[email protected]"
package-description: "The official Java library for Cohere\\'s API."
reference-url: "https://docs.cohere.com"
output:
location: maven
url: https://s01.oss.sonatype.org/content/repositories/releases/
coordinate: com.cohere:cohere-java
username: ${MAVEN_USERNAME}
password: ${MAVEN_PASSWORD}
signature:
keyId: ${MAVEN_CENTRAL_SECRET_KEY_KEY_ID}
password: ${MAVEN_CENTRAL_SECRET_KEY_PASSWORD}
secretKey: ${MAVEN_CENTRAL_SECRET_KEY}
github:
repository: cohere-ai/cohere-java
mode: pull-request
license: MIT
config:
client-class-name: Cohere
python-sdk:
audiences:
- public
- v2-beta
generators:
- name: fernapi/fern-python-sdk
version: 4.3.11
smart-casing: true
config:
pyproject_python_version: "^3.9"
inline_request_params: false
extra_dev_dependencies:
parameterized: "^0.9.0"
extra_dependencies:
fastavro: "^1.9.4"
requests: "^2.0.0"
types-requests: "^2.0.0"
tokenizers: ">=0.15,<1"
httpx-sse: ^0.4.0
parameterized: "^0.9.0"
improved_imports: true
pydantic_config:
frozen: false
union_naming: v1
require_optional_fields: false
extra_fields: "allow"
use_str_enums: true
skip_validation: true
timeout_in_seconds: 300
client:
class_name: BaseCohere
filename: base_client.py
exported_class_name: Client
exported_filename: client.py
additional_init_exports:
- from: client
imports:
- Client
- AsyncClient
- from: bedrock_client
imports:
- BedrockClient
- BedrockClientV2
- from: sagemaker_client
imports:
- SagemakerClient
- SagemakerClientV2
- from: aws_client
imports:
- AwsClient
- from: client_v2
imports:
- AsyncClientV2
- ClientV2
output:
location: pypi
package-name: cohere
token: ${PYPI_TOKEN}
github:
license: MIT
repository: cohere-ai/cohere-python
branch: main
mode: pull-request
7 changes: 7 additions & 0 deletions packages/autorelease/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};

Loading
Loading