This guide explains how to use the two-phase release and publish workflow for packages in this monorepo.
The workflow consists of two phases:
- Phase 1a: Create Release - Creates a GitHub release with a package tarball for testing
- Phase 1b: UAT (User Acceptance Testing) - Manual testing of the release candidate
- Phase 2: Publish Release - Publishes the tested package to NPM
.github/workflows/
├── base-create-release.yml # Base reusable workflow for creating releases
├── base-publish-release.yml # Base reusable workflow for publishing releases
├── mobile-web-create-release.yml # Mobile Web specific create release workflow
└── mobile-web-publish-release.yml # Mobile Web specific publish release workflow
base-create-release.yml- Contains all the logic for creating releasesbase-publish-release.yml- Contains all the logic for publishing releases
These workflows:
- Use
workflow_calltrigger to make them reusable - Accept package-specific parameters as inputs
mobile-web-create-release.yml- Calls base-create-release with mobile-web parametersmobile-web-publish-release.yml- Calls base-publish-release with mobile-web parameters
Each package must have:
- A valid
package.jsonfile - A
buildscript (if the package needs building) - A
testscript (for running tests during release)
- Go to the Actions tab in your GitHub repository
- Select the package-specific create release workflow (e.g.,
Mobile Web - Create Release) - Click Run workflow
- Select the branch you want to run against
- Mobile Web MCP Server:
Mobile Web - Create Release - (Add new packages here as they're created)
- Validates the package structure and dependencies
- Runs tests to ensure package quality
- Builds the package using the build script
- Creates a tarball using
npm pack - Creates a git tag with format
<package-name>_v<version> - Creates a GitHub release marked as prerelease with the tarball attached as an asset, and automatically generated release notes
- Git Tag:
<package-name>_v<version>(e.g.,salesforce-mobile-web-mcp-server_v1.2.3) - Release Name:
<package-display-name> v<version>(e.g.,Mobile Web MCP Server v1.2.3)
The package name for tags is derived from the full package name in package.json, replacing slashes with dashes.
The workflow automatically generates comprehensive release notes using GitHub's built-in release notes generation feature. This automatically includes:
- What's Changed: Automatically generated from pull request titles and descriptions
- New Contributors: Information about first-time contributors to the project
- Full Changelog: Link to view all changes between releases
The release notes also include:
- Package name and version
- Brief description of the release as a testing candidate
- Instructions to use the publish workflow after testing
The automatically generated content is combined with the testing instructions to provide both detailed change information and clear next steps for the release process.
- Navigate to the created GitHub release
- Review the release notes and package details
- Download the package tarball (
.tgzfile) - Test the package in your target environment:
# Install the tarball locally
npm install path/to/downloaded-package.tgz
# Or test in a separate project
cd /path/to/test-project
npm install /path/to/downloaded-package.tgz- Perform your acceptance testing
- If issues are found, fix them and create a new release (increment version first)
- Go to the Actions tab in your GitHub repository
- Select the package-specific publish workflow (e.g.,
Mobile Web - Publish Release) - Click Run workflow
- Fill in the parameters:
- Release tag: The git tag of the release to publish (e.g.,
salesforce-mobile-web-mcp-server_v1.0.0) - NPM tag: The NPM tag to publish under (dropdown with options:
latest,beta,alpha,next) - Dry run: Check this to test without actually publishing
- Release tag: The git tag of the release to publish (e.g.,
- Mobile Web MCP Server:
Mobile Web - Publish Release - (Add new packages here as they're created)
- Validates the release tag and checks if the release exists
- Downloads the tarball from the GitHub release
- Verifies the tarball contents match the expected version
- Checks if the version is already published on NPM
- Publishes the package to NPM with the specified tag
- Updates the GitHub release to remove the prerelease flag
latest(default): The main release channelbeta: Beta releasesalpha: Alpha releasesnext: Next version previews
To support a new package in the release workflow:
- Create the create release workflow (e.g.,
.github/workflows/your-package-create-release.yml):
name: Your Package - Create Release
run-name: Create release for Your Package
on:
workflow_dispatch:
jobs:
create-release:
uses: ./.github/workflows/base-create-release.yml
with:
package_display_name: 'Your Package Display Name'
package_path: 'packages/your-package'
permissions:
contents: write
packages: write- Create the publish release workflow (e.g.,
.github/workflows/your-package-publish-release.yml):
name: Your Package - Publish Release
run-name: Publish Your Package release to NPM
on:
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag to publish (e.g., your-package_v1.0.0)'
required: true
type: string
npm_tag:
description: 'NPM tag to publish under'
required: false
type: choice
options:
- latest
- beta
- alpha
- next
default: 'latest'
dry_run:
description: 'Perform a dry run (do not actually publish)'
required: false
type: boolean
default: false
jobs:
publish-release:
uses: ./.github/workflows/base-publish-release.yml
with:
package_display_name: 'Your Package Display Name'
package_path: 'packages/your-package'
release_tag: ${{ inputs.release_tag }}
npm_tag: ${{ inputs.npm_tag }}
dry_run: ${{ inputs.dry_run }}
secrets: inherit
permissions:
contents: write
packages: write-
Ensure your package follows the standard structure with
package.json, build script, and test script -
Update this documentation to list the new workflows in the "Available Package Workflows" sections
-
"Tag already exists": The version hasn't been bumped since the last release
- Solution: Update the version in
package.json
- Solution: Update the version in
-
"Package already published": Trying to publish a version that already exists
- Solution: Increment the version and create a new release
-
"NPM credentials not configured": Missing or invalid NPM_TOKEN
- Solution: Add valid NPM_TOKEN to repository secrets
-
"Build failed": Package build script failed
- Solution: Fix build issues and ensure
npm run buildworks locally
- Solution: Fix build issues and ensure
-
"Tests failed": Package tests failed during release
- Solution: Fix failing tests and ensure
npm run testpasses locally
- Solution: Fix failing tests and ensure