Skip to content

fix(cli): try to resolve `Cannot read properties of undefined (readin… #542

fix(cli): try to resolve `Cannot read properties of undefined (readin…

fix(cli): try to resolve `Cannot read properties of undefined (readin… #542

Workflow file for this run

name: Publish Dev + Prod CLIs
on:
push:
branches:
- main
workflow_dispatch:
inputs:
version:
description: "The version of the CLI to publish."
required: true
type: string
jobs:
publish-dev:
if: ${{ inputs.version == null }}
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Install
uses: ./.github/actions/install
- name: Print version
run: |
git_version="$(./scripts/git-version.sh)"
echo Publishing version: "${git_version}"
- name: Add version to dev package.json's
run: |
git_version="$(./scripts/git-version.sh)"
pnpm seed:local publish cli --ver ${git_version} --dev --log-level debug
# Test prod and try to publish, the publish command will handle if there's no diff
live-test:
if: ${{ inputs.version == null }}
environment: Fern Prod
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install
uses: ./.github/actions/install
- name: Check API definition is valid
env:
FORCE_COLOR: "2"
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY }}
run: |
pnpm --filter @fern-api/cli dist:cli:prod
cli_path="$(pwd)/packages/cli/cli/dist/prod/bundle.cjs"
./scripts/live-test.sh "$cli_path" "$FERN_TOKEN"
publish:
needs: [live-test]
if: ${{ inputs.version == null }}
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 2
fetch-tags: true
- name: Install
uses: ./.github/actions/install
- name: Publish + Register CLI
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
git show HEAD~1:packages/cli/cli/versions.yml > tmp_cli_previous_versions.yml
pnpm seed:local publish cli --changelog packages/cli/cli/versions.yml --previous-changelog tmp_cli_previous_versions.yml --log-level debug
pnpm seed:local register cli
publish-manually:
runs-on: ubuntu-latest
if: ${{ inputs.version != null }}
env:
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-tags: true
- name: Install
uses: ./.github/actions/install
- name: Publish + Register CLI
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
pnpm seed:local publish cli --ver ${{ inputs.version }} --log-level debug
pnpm seed:local register cli