-
Notifications
You must be signed in to change notification settings - Fork 3
chore: add-patch-release-docs-and-workflow #300
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
||
|
@@ -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' | ||
|
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Parameter name inconsistency with CI workflow. This workflow uses Based on the JamesIves/github-pages-deploy-action documentation, Note: This issue was also flagged in the ci.yml review above. 🤖 Prompt for AI Agents
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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 usesfolder
as the parameter name for specifying the deployment directory.🌐 Web query:
Error during web search
🌐 Web query:
💡 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
tofolder
:📝 Committable suggestion
🤖 Prompt for AI Agents