chore(ci): Add Docker image publishing for fern-cli#14857
chore(ci): Add Docker image publishing for fern-cli#14857
Conversation
Co-Authored-By: Timothy Gragg <pipergragg@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
Re: Issue #2 —
|
…o fernapi/fern and fernapi/fern-dev Co-Authored-By: Timothy Gragg <pipergragg@gmail.com>
Co-Authored-By: Timothy Gragg <pipergragg@gmail.com>
…th yq Co-Authored-By: Timothy Gragg <pipergragg@gmail.com>
Description
Adds Docker image publishing to the CLI release workflow so that
fernapi/fernandfernapi/fern-devimages are available on Docker Hub. This enables customer GitHub Actions workflows to usecontainer: image: fernapi/fern:latestinstead of runningnpm install -g fern-apion every run, saving ~10s per workflow execution.Companion PR: fern-api/fern-platform#9604 (updates customer workflow templates to use the container-based approach).
Changes Made
packages/cli/cli/Dockerfile: New Dockerfile based onnode:22-slimwith git and the Fern CLI pre-installed. Uses build args (FERN_CLI_PACKAGE,FERN_CLI_VERSION) to support both prod and dev CLI variants.FERN_CLI_VERSIONis a required build arg with no default — the build fails explicitly if not supplied, ensuring hermetic builds.ENTRYPOINT []allows GitHub Actions to run arbitrary commands in the container. Placed adjacent toversions.ymlfor consistency with the SDK generator setup..github/workflows/publish-cli-docker.yml: New reusableworkflow_callworkflow that builds and pushes Docker images to Docker Hub. Acceptsversion(string) andis_dev(boolean) inputs. Tags images with both the specific version andlatest. Uses Docker Buildx with GHA cache..github/workflows/publish-cli.yml: Hooks the new Docker publish workflow into every CLI release path:dev→ publishesfernapi/fern-devat the git versionprod→ publishes bothfernapi/fernandfernapi/fern-devat the release versionmanual→ publishes both images at the input versionoutputstodevandprodjobs to pass the resolved version to downstream Docker jobsprodjob'sget_cli_versionstep usesyq '.[0].version'for robust version extraction fromversions.ymlUpdates Since Last Revision
Addressed review feedback:
latestdefault fromFERN_CLI_VERSIONDockerfile ARG. The build now fails explicitly if the version is not supplied, ensuring the installed CLI version is always in lock-step with the Docker image tag.head | grep | awkversion extraction in theprodjob'sget_cli_versionstep withyq '.[0].version'. The oldgrep "version:"pattern could matchirVersion:lines.Human Review Checklist
devjob refactor: The version computation was split from the publish step into a separateget_git_versionstep so it can be exposed as a job output. Verify the publish step still correctly consumes the version via${{ steps.get_git_version.outputs.git_version }}.secrets: inherit: All Docker jobs usesecrets: inheritto passFERN_API_DOCKERHUB_PASSWORDto the reusable workflow. Confirm this secret is available in the repo (it's already used byseed-dockers.yml).ENTRYPOINT []: Required for GitHub Actionscontainer:directive to work—without it, Actions can't run arbitrary shell commands.yqusage: Theprodjob now usesyq '.[0].version'to extract the CLI version.yqis pre-installed onubuntu-latestrunners. Note: thebulk-update-clijob still uses the oldgrep/awkpattern (tracked in chore(ci): replace fragile grep/awk version extraction with yq #14860).Testing
fernapi/FERN_API_DOCKERHUB_PASSWORD) are consistent with existing usage inseed-dockers.ymlLink to Devin session: https://app.devin.ai/sessions/9750ac886908477394299692162b2aa8
Requested by: @pgragg