This is the monorepo of twreporter congress dashboard. This monorepo containing follow sub-packages:
- @twreporter-congress-dashboard/frontend: see
packages/frontend
- @twreporter-congress-dashboard/cms: see
packages/cms
- @twreporter-congress-dashboard/shared: see
packages/shared
We use lerna v8 with yarn workspace
to manage this monorepo.
We also use Changesets for version management and automated releases.
Please refer to lerna document for the cli commands details.
We use yarn
for dependency management.
Please install dependencies on root before execution.
$ yarn install
- add sub-package under
/packages
folder - add sub-package info in this
README.md
We use Changesets for automated version management, changelog generation, and publishing. Here's how to work with it:
When you make changes that should trigger a version bump, create a changeset:
$ yarn changeset
This will:
- Ask which packages have been changed
- Ask whether the change is a major, minor, or patch
- Ask for a summary of the change
- Generate a changeset file in
.changeset/
- Automatically commit the changeset file
- Patch: Bug fixes, small improvements
- Minor: New features, non-breaking changes
- Major: Breaking changes
We use Conventional Commits enforced by commitlint. All commit messages must follow this format:
# Make your changes
$ git checkout -b feature/my-feature
# Create a changeset (this will auto-commit the changeset file)
$ yarn changeset
# Follow the prompts to describe your changes
# Commit your changes
$ git add .
$ git commit -m "feat: add new feature"
$ git push origin feature/my-feature
# Create a pull request
Our CI/CD pipeline automatically handles versioning and publishing based on the target branch:
Branch | Action | Version Format | NPM Tag | Description |
---|---|---|---|---|
dev |
Auto-publish | 1.2.3-beta.0 |
beta |
Development releases |
master |
Auto-publish | 1.2.3-rc.0 |
rc |
Release candidate |
staging |
Sync & publish | 1.2.3-rc.0 |
rc |
Staging deployment (no bump) |
release |
Auto-publish | 1.2.3 |
latest |
Production release |
# Create a new changeset
$ yarn changeset
# Check changeset status
$ yarn changeset:status
# Version packages (usually done by CI)
$ yarn changeset:version
# Publish packages (usually done by CI)
$ yarn changeset:publish
# Preview what versions would be bumped
$ yarn changeset:status
# Apply version bumps locally (for testing)
$ yarn changeset:version
# Publish manually (for emergency releases)
$ yarn changeset:publish
We use a combination of GCP cloud run
for hosting and GitHub Actions for automated CI/CD with Changesets integration.
- Trigger: Push to
dev
branch - Action: Creates beta releases automatically
- Version:
1.2.3-beta.0
,1.2.3-beta.1
, etc. - NPM Tag:
beta
- File:
.github/workflows/dev-beta-release.yml
- Trigger: Push to
master
branch - Action: Creates RC releases automatically
- Version:
1.2.3-rc.0
,1.2.3-rc.1
, etc. - NPM Tag:
rc
- File:
.github/workflows/master-rc-release.yml
- Trigger: Push to
staging
branch - Action: Syncs with master, publishes existing RC version
- Version: No bump, uses current RC version
- NPM Tag:
rc
- File:
.github/workflows/staging-sync.yml
- Trigger: Push to
release
branch - Action: Creates production release and syncs back to master/staging
- Version:
1.2.3
(removes pre-release tags) - NPM Tag:
latest
- File:
.github/workflows/release-production.yml
- Trigger: Pull request opened/updated
- Action: Checks for changeset files and shows status
- File:
.github/workflows/changeset-pr.yml
To add new service in this project, please add the following configuration:
- Add
Dockerfile
under your sub-package folder.cloudbuild.yaml
will execute thedocker build
command for the target package.
- Configure your service on
cloud run
. - Add a trigger to
cloud build
.- Use the
congress-dashboard-cloud-build
service account. - Add
substitutions
. - Include
packages/<sub-package name>/**
in the files filter.
- Use the
- Add your service to the
load-balancer
. - Configure DNS settings on
cloudflare
.
For the automated workflows to work, make sure these secrets are configured in GitHub:
NPM_TOKEN
: Token for publishing to npm registry.GITHUB_TOKEN
: Automatically provided by GitHub Actions.
- No changeset found warning: Create a changeset with
yarn changeset
. - Version conflicts: Check
yarn changeset:status
and resolve manually. - Publishing fails: Verify
NPM_TOKEN
is set correctly in GitHub secrets. - Workflow not triggering: Check branch names match exactly (
dev
,master
,staging
,release
).
- Check workflow runs in the GitHub Actions tab.
- Verify secrets are configured.
- Ensure changesets are committed with your changes.
- Check
package.json
publishConfig
settings.