feat(cli): support bytes in the fern definition (#5388) #1048
This file contains 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 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: Build Seed | |
run: | | |
pnpm seed:build | |
- name: Print version | |
run: | | |
git_version="$(./scripts/git-version.sh)" | |
echo Publishing version: "${git_version}" | |
- name: Publish Dev CLI | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
git_version="$(./scripts/git-version.sh)" | |
pnpm seed 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/cli.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 | |
- name: Install | |
uses: ./.github/actions/install | |
- name: Build Seed | |
run: | | |
pnpm seed:build | |
- 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 | |
previous_commit="$(git rev-parse --short HEAD~1)" | |
echo "Preview of the previous file ${previous_commit}" | |
head tmp_cli_previous_versions.yml | |
current_commit="$(git rev-parse --short HEAD)" | |
echo "Preview of the current file ${current_commit}" | |
head packages/cli/cli/versions.yml | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
pnpm seed publish cli --changelog packages/cli/cli/versions.yml --previous-changelog tmp_cli_previous_versions.yml --log-level debug | |
pnpm seed 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: Build Seed | |
run: | | |
pnpm seed:build | |
- name: Publish + Register CLI | |
env: | |
FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
pnpm seed publish cli --ver ${{ inputs.version }} --log-level debug | |
pnpm seed register cli |