-
Notifications
You must be signed in to change notification settings - Fork 20
61 lines (54 loc) · 2.52 KB
/
Copy pathrelease-cli.yml
File metadata and controls
61 lines (54 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Release CLI
on:
push:
branches:
- main
paths:
# a) API definition changes (source of truth)
- "fern/apis/api/definition/**"
# b) Committed OpenAPI export changes
- "openapi/openapi.yml"
# c) CLI generator config / overrides changes
- "fern/apis/cli/generators.yml"
- "fern/apis/cli/openapi-overrides.yml"
# d) Fern CLI version changes
- "fern/fern.config.json"
workflow_dispatch:
inputs:
version:
description: "Version to stamp into the generated CLI (e.g. 1.0.0). The release tag on the output repo must match it exactly — ci.yml's version guard blocks publishes when they disagree. Release generation must state its version explicitly; only push-triggered drift regens use AUTO."
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Setup Fern CLI
uses: fern-api/setup-fern-cli@v1
- name: Re-export OpenAPI from definition
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: fern generate --api api --group openapi --local --force --no-prompt
# Fail fast if the freshly exported spec and the CLI overlays have
# drifted: a new endpoint without annotations would silently lose its
# command hierarchy, and an override for a deleted endpoint would become
# a synthetic dead command.
- name: Validate CLI overlays against exported spec
run: python3 bin/gen-cli-overrides.py --check
# `auth-schemes.<name>.token.env` is silently ignored unless `api.auth`
# names the scheme, so a config that looks tidier can quietly ship a CLI
# reading the wrong variable. See the script for the evidence.
- name: Validate CLI auth config
run: python3 bin/check-cli-auth-config.py
# Generation is dispatch-only for now. Push events still run the export
# and overlay validation above (so spec/overlay drift fails loudly), but
# do not generate: the pinned Fern CLI (5.44.8) predates the remote
# AUTO-version fix (5.63.1), and a push-triggered AUTO run would race a
# concurrent versioned dispatch for the same generated PR. Restore
# push-triggered generation after upgrading the Fern pin.
- name: Generate CLI
if: github.event_name == 'workflow_dispatch'
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: fern generate --api cli --group cli --log-level debug --version "${{ github.event.inputs.version }}"