Skip to content
Open
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
44 changes: 41 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,45 @@ jobs:

- run: pnpm exec playwright install

- uses: nrwl/nx-set-shas@v4
- name: Get base and head SHAs for Nx affected commands
id: get-shas
run: |
set -e # Exit immediately if a command exits with a non-zero status

# Check if 'gh' command is available
if ! command -v gh &> /dev/null; then
echo "Error: GitHub CLI (gh) is not installed." >&2
exit 1
fi

# Get latest release tag
echo "Fetching latest GitHub release..."
LATEST_RELEASE_TAG=$(gh release view --json tagName -q .tagName)

if [ -z "$LATEST_RELEASE_TAG" ]; then
exit 1
else
echo "Latest release tag: $LATEST_RELEASE_TAG"
# Get the commit SHA that this tag points to
BASE_SHA=$(git rev-list -n 1 $LATEST_RELEASE_TAG)
fi

# Get current HEAD SHA
HEAD_SHA=$(git rev-parse HEAD)

echo "Base SHA (latest release): $BASE_SHA"
echo "Head SHA (current): $HEAD_SHA"

# Set outputs for use with Nx
echo "base_sha=$BASE_SHA" >> $GITHUB_OUTPUT
echo "head_sha=$HEAD_SHA" >> $GITHUB_OUTPUT

# Export as environment variables for immediate use
echo "NX_BASE=$BASE_SHA" >> $GITHUB_ENV
echo "NX_HEAD=$HEAD_SHA" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# This line is needed for nx affected to work when CI is running on a PR
- run: git branch --track main origin/main

Expand Down Expand Up @@ -83,8 +121,8 @@ jobs:
- name: build docs
run: pnpm generate-docs

- name: preview-docs
uses: rajyan/preview-pages@v1
- name: Publish api docs
uses: JamesIves/github-pages[email protected]
with:
source-dir: docs
pr-comment: 'none'
Comment on lines +124 to 128
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the correct parameter name for JamesIves/github-pages-deploy-action.

The action configuration uses source-dir, but the JamesIves/github-pages-deploy-action typically uses folder as the parameter name for specifying the deployment directory.


🌐 Web query:

What is the correct parameter name for specifying the source directory in JamesIves/github-pages-deploy-action version 4.7.3?

Error during web search


🌐 Web query:

JamesIves/github-pages-deploy-action source-dir folder input

💡 Result:

The action expects the input name folder (not source-dir). Set with:

  • folder: build (or . for repo root; you can use ~ to prefix an absolute path). Example:

  • name: Deploy
    uses: JamesIves/github-pages-deploy-action@v4
    with:
    folder: build

References: [1][2]

Sources
[1] JamesIves github-pages-deploy-action examples/docs. [2] README/packaged docs and examples showing folder is the required input.


Fix the deployment input key
In .github/workflows/ci.yml, change the input from source-dir to folder:

-        with:
-          source-dir: docs
+        with:
+          folder: docs
           pr-comment: 'none'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Publish api docs
uses: JamesIves/[email protected]
with:
source-dir: docs
pr-comment: 'none'
- name: Publish api docs
uses: JamesIves/[email protected]
with:
folder: docs
pr-comment: 'none'
🤖 Prompt for AI Agents
In .github/workflows/ci.yml around lines 124 to 128, the GitHub Pages Deploy
action is using the deprecated input key `source-dir`; replace that key with
`folder` and set its value to the docs directory (i.e. change `source-dir: docs`
to `folder: docs`) so the JamesIves/[email protected] receives
the correct input.

Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/patch-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Release Patch
on:
workflow_dispatch:
inputs:
branch-name:
description: 'Name for the patch branch (typically like "patch-release-1.0.1")'
required: true

env:
NX_CLOUD_ENCRYPTION_KEY: ${{ secrets.NX_CLOUD_ENCRYPTION_KEY }}
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_CLOUD_DISTRIBUTED_EXECUTION: true
PNPM_CACHE_FOLDER: .pnpm-store
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CI: true

jobs:
create-and-publish-patch:
permissions:
contents: write # to create release (changesets/action)
issues: write # to post issue comments (changesets/action)
pull-requests: write # to create pull request (changesets/action)
id-token: write # give id token write for provenance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

# Check out the provided branch - fail if it doesn't exist
- name: Checkout patch branch
run: |
git checkout ${{ github.event.inputs.branch-name }}
# Setup environment
- uses: pnpm/action-setup@v4
with:
run_install: false
- uses: actions/setup-node@v4
with:
node-version: '22.14.0'
cache: 'pnpm'

- run: pnpm install --frozen-lockfile

# This line enables distribution for NX
- run: pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN"

- run: pnpm exec playwright install

- uses: nrwl/nx-set-shas@v4

- name: Setup pnpm config
run: pnpm config set store-dir $PNPM_CACHE_FOLDER

- name: Version packages
run: pnpm exec changeset version
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

# Build and test affected packages
- name: Build and test
run: pnpm exec nx affected -t build lint test e2e-ci

- name: Publish patch
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_ACCESS_TOKEN" > .npmrc
pnpm publish -r
env:
NPM_CONFIG_PROVENANCE: 'true'
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}

# Use changeset tag to create git tags according to changesets config
- name: Create and push git tags
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
pnpm exec changeset tag
git push --follow-tags
# Build and publish docs for the patch
- name: Build docs
run: pnpm generate-docs

- name: Publish api docs
uses: JamesIves/[email protected]
with:
folder: docs
commit-message: 'chore: release-api-docs-patch'
Comment on lines +87 to +91
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Parameter name inconsistency with CI workflow.

This workflow uses folder: docs (line 90) while ci.yml uses source-dir: docs (line 127) for the same JamesIves/github-pages-deploy-action. They should use the same parameter name.

Based on the JamesIves/github-pages-deploy-action documentation, folder is the correct parameter name. The ci.yml workflow should be updated to match.

Note: This issue was also flagged in the ci.yml review above.

🤖 Prompt for AI Agents
In .github/workflows/patch-release.yml around lines 87 to 91 there is a
parameter inconsistency with another workflow (ci.yml): this job uses "folder:
docs" while ci.yml uses "source-dir: docs"; update the ci.yml workflow to use
the correct parameter name by replacing "source-dir: docs" with "folder: docs"
(and confirm both workflows use the same action version and parameter name so
they match).

51 changes: 51 additions & 0 deletions contributing_docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,54 @@ We provide verdaccio two ways:
topological graph.

- Publishing to a hosted private registry: Please message @ryanbas21 on slack.

# Patch Releases

In the event a patch release is required, we should always fix the bug on `main` before releasing any code.

This follows the trunk based development style of releasing which is best suited for changesets.

Once the bug is confirmed fixed, we can cherry-pick the fix from main, onto the latest release branch.

This cherry-pick should contain a changeset, if it does not, we will need to add one.

Once we have that new release branch confirmed working, and it has a changeset, we can push the branch to github.

We can then use the workflow_dispatch github workflow, called patch-release.yml, pass in the branch to release from as an input.

This will kickoff the release workflow, including building, testing, linting, etc.

Once passing, we will attempt to publish with provenance from CI (signing the packages).

It is worth noting that we could be on 1.0.1 on `npm` and our `main` branch may be on versions `1.0.0`. But because we push the tag up, changesets should respect the tag, and versions should be triggered based on the tag in the Release PR

## Patch Release Process

- Identify and fix the bug on main first
This allows us to properly reproduce and verify the fix
It ensures proper code review through your normal PR process
The fix gets merged to main and will be included in future releases

- After the fix is merged to main, cherry-pick it to a patch branch

- Create a branch from the last release tag (e.g., v1.0.0)

- Cherry-pick the bugfix commit(s) from main to this patch branch

- Add a changeset file describing the patch change

- Push the patch branch and run the patch workflow

- This will publish the patch version (e.g., 1.0.1)

- No need to merge back to main

Since the fix already exists on main, there's no need to merge back
This prevents any potential merge conflicts or duplication

This approach provides several benefits:

- Ensures the bug is properly identified and fixed first
- Maintains normal code review process
- Creates a clean git history with the fix clearly flowing from main to the patch branch
- Avoids duplication of changes or complicated merge operations
Loading