Skip to content
Merged
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
55 changes: 55 additions & 0 deletions .github/RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Release Process

This repository uses a fully automated release process based on semantic versioning and GitHub Actions.

## How It Works

### 1. Pull Request Testing

When you create a pull request that changes files in the `packages/` directory:

- The `pullrequest.yml` workflow automatically runs
- It builds and tests all packages
- It performs a dry-run of semantic-release to verify version changes
- A summary shows what packages would be published when merged

This ensures that releases will work correctly once merged to main.

### 2. Automatic Release on Merge

When a pull request is merged to the `main` branch:

- The `release.yml` workflow automatically runs
- It builds and tests all packages
- It identifies which packages have changes
- For each changed package:
- Determines the next version based on conventional commits
- Publishes to npm if there's a version bump
- Creates a GitHub release with changelog

## Conventional Commits

This repo follows the [Conventional Commits](https://www.conventionalcommits.org/) standard to determine version bumps:

- `feat:` - Creates a minor version bump (0.1.0 → 0.2.0)
- `fix:` - Creates a patch version bump (0.1.0 → 0.1.1)
- `docs:`, `style:`, `refactor:`, `perf:`, `test:`, `build:`, `ci:` - Creates a patch bump
- `chore(deps):` - Updates to dependencies create a patch bump
- `BREAKING CHANGE:` in commit body - Creates a major version bump (0.1.0 → 1.0.0)

## Troubleshooting

If a release fails:

1. Check the GitHub Actions logs for errors
2. Fix any issues in a new PR
3. When merged to main, the release will run again automatically

## Testing Release Process

To test the release process without publishing packages:

1. Create a PR with your changes
2. The PR workflow will run semantic-release in dry-run mode
3. Review the workflow logs to see what would be released
4. Only when merged to main will actual publishing occur
24 changes: 16 additions & 8 deletions .github/release-template.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
["@semantic-release/commit-analyzer", {
"preset": "angular",
"releaseRules": [
{"type": "feat", "release": "minor"},
{"type": "fix", "release": "patch"},
{"type": "docs", "release": "patch"},
{"type": "style", "release": "patch"},
{"type": "refactor", "release": "patch"},
{"type": "perf", "release": "patch"},
{"type": "test", "release": "patch"},
{"type": "build", "release": "patch"},
{"type": "ci", "release": "patch"},
{"type": "chore", "scope": "deps", "release": "patch"}
]
}],
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
["@semantic-release/github", {
"assets": []
}],
["@semantic-release/git", {
"assets": ["package.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}]
"@semantic-release/github"
]
}
135 changes: 0 additions & 135 deletions .github/workflows/npm-publish.yml

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Pull Request

on:
pull_request:
paths:
- 'packages/**'
- '.github/workflows/**'

jobs:
test-and-verify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Test
run: yarn test

- name: Find changed packages
id: changed_packages
run: |
CHANGED_DIRS=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -o 'packages/[^/]*' | sort | uniq)
echo "Changed packages: $CHANGED_DIRS"
echo "dirs=$CHANGED_DIRS" >> $GITHUB_OUTPUT

- name: Dry run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get the space-separated list of changed directories
CHANGED_PACKAGES="${{ steps.changed_packages.outputs.dirs }}"

# Create a release template if it doesn't exist
if [ ! -f .github/release-template.json ]; then
echo '{"branches": ["main"], "plugins": [["@semantic-release/commit-analyzer", { "preset": "angular" }], "@semantic-release/release-notes-generator", "@semantic-release/npm", "@semantic-release/github"]}' > .github/release-template.json
fi

# Perform dry run for each changed package
for PKG in $CHANGED_PACKAGES; do
echo "Testing release for package: $PKG"
cd $PKG

# Check if .releaserc.json exists, create if not
if [ ! -f .releaserc.json ]; then
echo "Creating .releaserc.json from template"
cp ../../.github/release-template.json .releaserc.json
fi

# Run semantic-release dry run to verify it will work when merged
npx semantic-release --dry-run

cd ../../
done

- name: Package information summary
env:
CHANGED_PACKAGES: ${{ steps.changed_packages.outputs.dirs }}
run: |
echo "## Package Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

for PKG in $CHANGED_PACKAGES; do
echo "### ${PKG}" >> $GITHUB_STEP_SUMMARY
cd $PKG
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "- Current version: ${CURRENT_VERSION}" >> $GITHUB_STEP_SUMMARY
cd ../../
done

echo "" >> $GITHUB_STEP_SUMMARY
echo "This PR is safe to merge. Once merged to main, packages will be published automatically." >> $GITHUB_STEP_SUMMARY
Loading