chore(cli): release 5.89.3 #7689
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Fern CLI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - "fern/**" | |
| - "guides/**" | |
| - ".vscode/**" | |
| - "docker/seed/**" | |
| - "test-definitions/**" | |
| - "test-definitions-openapi/**" | |
| - "seed/**" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "The version of the CLI to publish." | |
| required: true | |
| type: string | |
| permissions: | |
| contents: read # Required for checkout | |
| id-token: write # Required for OIDC | |
| env: | |
| DO_NOT_TRACK: "1" | |
| TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
| TURBO_TEAM: "buildwithfern" | |
| TURBO_NO_UPDATE_NOTIFIER: "1" | |
| TURBO_DAEMON: "false" | |
| jobs: | |
| detect-release-bump: | |
| if: ${{ inputs.version == null && github.repository == 'fern-api/fern' }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_release_bump: ${{ steps.check_versions_yml.outputs.is_release_bump }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check if versions.yml changed | |
| id: check_versions_yml | |
| run: | | |
| if git diff --name-only HEAD~1..HEAD | grep -q '^packages/cli/cli/versions.yml$'; then | |
| echo "is_release_bump=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "is_release_bump=false" >> $GITHUB_OUTPUT | |
| fi | |
| dev: | |
| needs: [detect-release-bump] | |
| if: ${{ inputs.version == null && github.repository == 'fern-api/fern' && needs.detect-release-bump.outputs.is_release_bump == 'false' }} | |
| concurrency: | |
| group: publish-cli-dev | |
| cancel-in-progress: true | |
| runs-on: ubuntu-latest | |
| env: | |
| AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }} | |
| AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }} | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY }} | |
| SENTRY_DSN: ${{ secrets.SENTRY_DSN_CLI }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.FERN_SENTRY_AUTH_TOKEN }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Install | |
| uses: ./.github/actions/install | |
| - name: Build Seed | |
| run: | | |
| pnpm seed:build | |
| - name: Print version | |
| run: | | |
| git_version="$(./scripts/git-version.sh)" | |
| echo Publishing version: "${git_version}" | |
| # npm >= 11.5.1 is required for OIDC trusted publishing (pnpm publish | |
| # delegates to npm under the hood). Node 22 ships with npm 10.x. | |
| # Two-step upgrade works around Node 22.22.2 regression (npm/cli#9151). | |
| - name: Update npm for OIDC publishing | |
| run: npm install -g npm@10.9.8 && npm install -g npm@11 | |
| - name: Publish Dev CLI | |
| run: | | |
| git_version="$(./scripts/git-version.sh)" | |
| pnpm seed publish cli --ver ${git_version} --dev --log-level debug | |
| live-test: | |
| if: ${{ inputs.version == null && github.repository == 'fern-api/fern' }} | |
| environment: Fern Prod | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - 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 turbo run dist:cli:prod --filter @fern-api/cli | |
| cli_path="$(pwd)/packages/cli/cli/dist/prod/cli.cjs" | |
| ./scripts/live-test.sh "$cli_path" "$FERN_TOKEN" "true" | |
| prod: | |
| needs: [live-test, detect-release-bump] | |
| if: ${{ inputs.version == null && needs.detect-release-bump.outputs.is_release_bump == 'true' }} | |
| concurrency: | |
| group: publish-cli-release | |
| cancel-in-progress: false | |
| runs-on: ubuntu-latest | |
| env: | |
| AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }} | |
| AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }} | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY }} | |
| SENTRY_DSN: ${{ secrets.SENTRY_DSN_CLI }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.FERN_SENTRY_AUTH_TOKEN }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| fetch-depth: 20 | |
| - name: Install | |
| uses: ./.github/actions/install | |
| - name: Build Seed | |
| run: | | |
| pnpm seed:build | |
| # npm >= 11.5.1 is required for OIDC trusted publishing (pnpm publish | |
| # delegates to npm under the hood). Node 22 ships with npm 10.x. | |
| # Two-step upgrade works around Node 22.22.2 regression (npm/cli#9151). | |
| - name: Update npm for OIDC publishing | |
| run: npm install -g npm@10.9.8 && npm install -g npm@11 | |
| - name: Publish + Register CLI | |
| env: | |
| FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | |
| run: | | |
| previous_commit=$(git log -n 2 --pretty=format:"%h" -- packages/cli/cli/versions.yml | tail -n 1) | |
| current_commit=$(git log -n 1 --pretty=format:"%h" -- packages/cli/cli/versions.yml) | |
| # Get the previous version of the file using the specific commit that last changed it | |
| git show ${previous_commit}:packages/cli/cli/versions.yml > tmp_cli_previous_versions.yml | |
| echo "Preview of the previous file (${previous_commit})" | |
| head tmp_cli_previous_versions.yml | |
| echo "Preview of the current file (${current_commit})" | |
| head packages/cli/cli/versions.yml | |
| # Publish dev CLI at the same version as prod | |
| pnpm seed publish cli --changelog packages/cli/cli/versions.yml --previous-changelog tmp_cli_previous_versions.yml --log-level debug --dev | |
| # Publish prod CLI | |
| pnpm seed publish cli --changelog packages/cli/cli/versions.yml --previous-changelog tmp_cli_previous_versions.yml --log-level debug | |
| pnpm seed register cli | |
| manual: | |
| runs-on: ubuntu-latest | |
| if: ${{ inputs.version != null }} | |
| concurrency: | |
| group: publish-cli-release | |
| cancel-in-progress: false | |
| env: | |
| AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }} | |
| AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }} | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY }} | |
| SENTRY_DSN: ${{ secrets.SENTRY_DSN_CLI }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.FERN_SENTRY_AUTH_TOKEN }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-tags: true | |
| - name: Install | |
| uses: ./.github/actions/install | |
| - name: Build Seed | |
| run: | | |
| pnpm seed:build | |
| # npm >= 11.5.1 is required for OIDC trusted publishing (pnpm publish | |
| # delegates to npm under the hood). Node 22 ships with npm 10.x. | |
| # Two-step upgrade works around Node 22.22.2 regression (npm/cli#9151). | |
| - name: Update npm for OIDC publishing | |
| run: npm install -g npm@10.9.8 && npm install -g npm@11 | |
| - name: Publish Dev CLI | |
| run: | | |
| pnpm seed publish cli --ver ${{ inputs.version }} --dev --log-level debug | |
| - name: Publish + Register CLI | |
| env: | |
| FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | |
| run: | | |
| pnpm seed publish cli --ver ${{ inputs.version }} --log-level debug | |
| pnpm seed register cli | |
| bulk-update-cli: | |
| runs-on: ubuntu-latest | |
| needs: [prod, manual] | |
| if: ${{ always() && (needs.prod.result == 'success' || needs.manual.result == 'success') }} | |
| env: | |
| # Autopilot host URL (should include scheme, e.g., https://autopilot.example.com) | |
| AUTOPILOT_HOST: ${{ vars.AUTOPILOT_HOST != '' && vars.AUTOPILOT_HOST || 'https://autopilot.buildwithfern.com' }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| - name: Get CLI version | |
| id: get_version | |
| run: | | |
| if [ -n "${{ inputs.version }}" ]; then | |
| # Manual publish - use the input version | |
| echo "CLI_VERSION=${{ inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| # Automatic publish - extract from versions.yml | |
| version=$(head -n 20 packages/cli/cli/versions.yml | grep -m 1 "version:" | awk '{print $3}') | |
| echo "CLI_VERSION=${version}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Trigger bulk update | |
| env: | |
| FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | |
| run: | | |
| version="${{ steps.get_version.outputs.CLI_VERSION }}" | |
| host="${AUTOPILOT_HOST%/}" | |
| echo "Using autopilot host: ${host}" | |
| echo "Triggering bulk update for CLI version: ${version}" | |
| response=$(curl -s -w "\n%{http_code}" -X POST \ | |
| "${host}/api/bulk-update-cli" \ | |
| -H "Content-Type: application/json" \ | |
| -H "Authorization: Bearer ${FERN_TOKEN}" \ | |
| -d "{\"newVersion\": \"latest\", \"changeMode\": \"pull-request\"}") | |
| http_code=$(echo "$response" | tail -n 1) | |
| body=$(echo "$response" | sed '$d') | |
| echo "Response status: ${http_code}" | |
| echo "Response body: ${body}" | |
| if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then | |
| echo "✓ Bulk update triggered successfully" | |
| exit 0 | |
| else | |
| echo "✗ Bulk update failed with status ${http_code}" | |
| exit 1 | |
| fi |