Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal(seed): [DNM] command to get IR from generator version #4393

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 39 additions & 72 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,13 @@
name: Publish CLI
name: Publish Dev + Prod CLIs

on:
workflow_call:
inputs:
version:
description: "The version of the CLI to release"
required: true
type: string
workflow_dispatch:
inputs:
version:
description: "The version of the CLI to release"
required: true
type: string

# Add this permissions block
permissions:
contents: write
pull-requests: write
push:
branches:
- main

jobs:
live-test:
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-rc:
if: contains(inputs.version, '-rc')
publish-dev:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
Expand All @@ -62,13 +26,13 @@ jobs:

- name: Print version
run: |
git_version=${{ inputs.version }}
git_version="$(./scripts/git-version.sh)"
echo Publishing version: "${git_version}"

- name: Add version to dev package.json's
run: |
git_version=${{ inputs.version }}
git_version="$(./scripts/git-version.sh)"

cd packages/cli/cli
mv package.json package.json.tmp
version_replace="s/0.0.0/${git_version}/"
Expand All @@ -83,12 +47,33 @@ jobs:
- name: Compile
run: pnpm --filter @fern-api/cli compile

- name: Publish fern-api CLI
run: pnpm --filter @fern-api/cli publish:cli:prod --tag prerelease
- name: Publish fern-api-dev CLI
run: pnpm --filter @fern-api/cli publish:cli:dev --access restricted

# Test prod and try to publish, the publish command will handle if there's no diff
live-test:
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:
if: "!contains(inputs.version, '-rc')"
needs: live-test
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.FERN_NPM_TOKEN }}
Expand All @@ -105,28 +90,10 @@ jobs:
- name: Install
uses: ./.github/actions/install

- name: Print version
- name: Publish CLI
run: |
git_version=${{ inputs.version }}
echo Publishing version: "${git_version}"

- name: Add version to package.json's
run: |
git_version=${{ inputs.version }}

cd packages/cli/cli
mv package.json package.json.tmp
version_replace="s/0.0.0/${git_version}/"
cat package.json.tmp| sed "${version_replace}" > package.json
rm -rf package.json.tmp

echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc

- name: Update pnpm lock with new versions
run: pnpm install

- name: Compile
run: pnpm --filter @fern-api/cli compile
git show HEAD~1:packages/cli/cli/versions.yml > tmp_cli_previous_versions.yml
pnpm seed:local publish generator cli --versions-file packages/cli/cli/versions.yml --previous-versions-file tmp_cli_previous_versions.yml --log-level debug

- name: Publish fern-api CLI
run: pnpm --filter @fern-api/cli publish:cli:prod --tag latest
- name: Register CLI
run: pnpm seed:local register cli
51 changes: 0 additions & 51 deletions .github/workflows/publish-dev-cli.yml

This file was deleted.

Loading
Loading