Skip to content
Merged
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
21 changes: 7 additions & 14 deletions .github/workflows/publish-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
type: choice
description: Release type (release for main branch, prerelease for feature branches)
required: true
default: prerelease
default: release
options:
- release
- prerelease
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:

# Temporarily disable exit on error to capture output even when command fails
set +e
OUTPUT=$(GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} pnpm deploy:version -y --no-private --create-release github 2>&1)
OUTPUT=$(GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:version -- -y --no-private --create-release github 2>&1)
EXIT_CODE=$?
set -e

Expand All @@ -120,7 +120,7 @@ jobs:
# Publish to NPM
- name: Publish Release to NPM
run: |
GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} pnpm deploy:publish --ignore-scripts
GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:publish -- ${{ env.PUBLISH_FROM }} -y --pre-dist-tag beta --loglevel silly
Copy link
Contributor

Choose a reason for hiding this comment

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

${{ env.PUBLISH_FROM }} on line 123 is undefined in this workflow, so npm run deploy:publish receives an empty arg. Consider hard-coding from-git here (or define PUBLISH_FROM in env).

Suggested change
GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:publish -- ${{ env.PUBLISH_FROM }} -y --pre-dist-tag beta --loglevel silly
GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:publish -- from-git -y --pre-dist-tag beta --loglevel silly

🚀 Want me to fix this? Reply ex: "fix it for me".

Copy link

Choose a reason for hiding this comment

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

Undefined PUBLISH_FROM environment variable in deploy command

The deploy:publish command references ${{ env.PUBLISH_FROM }} but this environment variable is never defined anywhere in the workflow. This will result in an empty string being passed to the npm command, likely causing the publish step to fail or behave unexpectedly during production releases. The prerelease job correctly uses from-git as a literal value on line 188, suggesting this should also be a literal value rather than an undefined variable.

Fix in Cursor Fix in Web

env:
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}

Expand Down Expand Up @@ -174,24 +174,17 @@ jobs:
- name: Dry run pre-release version
if: ${{ github.event.inputs.releaseType == 'dry-run' }}
run: |
GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} pnpm deploy:version:dry-run -y --preid ${{ env.PREID }}
GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:version -- -y --no-private --conventional-prerelease --preid ${{ env.PREID }} --allow-branch ${{ steps.determine-branch.outputs.branch }} --no-changelog --no-push --no-git-tag-version

- name: Pre-release version
if: ${{ github.event.inputs.releaseType == 'prerelease' }}
run: |
GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} pnpm deploy:version -y --no-private --conventional-prerelease --preid ${{ env.PREID }} --allow-branch ${{ steps.determine-branch.outputs.branch }} --create-release github
GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:version -- -y --no-private --conventional-prerelease --preid ${{ env.PREID }} --allow-branch ${{ steps.determine-branch.outputs.branch }} --create-release github

# Use 'from git' option if `lerna version` has already been run
- name: Publish Pre-release to NPM
- name: Publish Release to NPM
if: ${{ github.event.inputs.releaseType == 'prerelease' }}
run: |
GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} pnpm deploy:publish --no-git-checks --ignore-scripts --tag ${{ env.PREID }}
GH_TOKEN=${{ secrets.GH_PUBLISH_TOKEN }} npm run deploy:publish -- from-git -y --ignore-scripts --pre-dist-tag ${{ env.PREID }}
env:
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}

- name: Dry run publish release to NPM
if: ${{ github.event.inputs.releaseType == 'dry-run' }}
env:
DRY_RUN: true
run: |
pnpm deploy:publish:dry-run
Loading