Skip to content

ci

ci #36

Workflow file for this run

name: ci
on:
push:
branches:
- master
workflow_dispatch:
inputs:
version:
description: Version
type: string
required: true
jobs:
fern-generate-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
- name: Download Fern
run: npm install -g fern-api
- name: Check Fern API is valid
run: fern check
- name: Get version from label-studio-sdk
id: sdk-version
if: inputs.version == ''
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GIT_PAT }}
script: |
const { repo, owner } = context.repo;
const sdk_repo = 'label-studio-sdk';
const pyProjectPath = 'pyproject.toml';
const {data: sdk_repo_data} = await github.rest.repos.get({
owner,
repo: sdk_repo,
});
const {data: commit} = await github.rest.repos.getCommit({
owner,
repo: sdk_repo,
ref: sdk_repo_data.default_branch,
});
const pyprojectBlob = await github.rest.repos.getContent({
owner,
repo: sdk_repo,
ref: commit.sha,
path: pyProjectPath,
});
const pyproject = Buffer.from(pyprojectBlob.data.content, pyprojectBlob.data.encoding).toString("utf8");
const versionMatch = pyproject.match(/version = "(?<version>[\.a-z0-9]+)"/);
if (versionMatch && versionMatch.groups.version) {
core.setOutput('version', versionMatch.groups.version);
} else {
throw `Version not found in ${pyprojectBlob.url}`
}
- name: Publish Python SDK PR
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: fern generate --group python-sdk-staging --version ${{ inputs.version || steps.sdk-version.outputs.version }} --log-level debug