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
19 changes: 17 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: Prepare Release
on:
workflow_dispatch:
inputs:
target_branch:
description: Release target branch
required: true
default: main
type: string
package:
description: Package to release
required: true
Expand Down Expand Up @@ -31,7 +36,7 @@ on:
type: string

concurrency:
group: ${{ github.workflow }}-${{ inputs.package }}-${{ inputs.version || inputs.release }}
group: ${{ github.workflow }}-${{ inputs.target_branch }}-${{ inputs.package }}-${{ inputs.version || inputs.release }}
cancel-in-progress: false

permissions: {}
Expand All @@ -45,10 +50,19 @@ jobs:
contents: write
pull-requests: write
steps:
- name: Validate target branch
env:
TARGET_BRANCH: ${{ inputs.target_branch }}
run: |
if [[ "$TARGET_BRANCH" != "main" && ! "$TARGET_BRANCH" =~ ^v[0-9]+(\.[0-9]+)?$ ]]; then
echo "Target branch must be main or a v* release branch (for example, v8 or v8.0)"
exit 1
fi

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: main
ref: ${{ inputs.target_branch }}
fetch-depth: 0
persist-credentials: false

Expand Down Expand Up @@ -82,4 +96,5 @@ jobs:
package-path: packages/${{ inputs.package }}
pr-body: ${{ steps.prepare.outputs.pr_body }}
tag: ${{ steps.prepare.outputs.tag }}
target-branch: ${{ inputs.target_branch }}
version: ${{ steps.prepare.outputs.version }}
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- "v[0-9]*"

permissions: {}

Expand Down
11 changes: 6 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,15 @@ All publishable packages in this repository use a pull-request-driven release fl
#### Prepare a Release

1. Run the [Prepare Release](.github/workflows/prepare-release.yml) workflow from the `main` branch.
2. Select `vite`, `create-vite`, or `plugin-legacy`.
3. Select a `release` type. The default `next` creates the next patch for a stable version or advances an existing prerelease. Alternatively, select another supported release type or enter an exact `version`, which takes precedence over `release`.
4. Wait for the action to open the release PR. The PR contains the selected package's version bump and changelog entry. A `create-vite` release also updates template Vite dependency versions when appropriate.
2. Enter the target branch. Use `main` for the current release line or a `v*` release branch (for example, `v8` or `v8.0`) for a patch release.
3. Select `vite`, `create-vite`, or `plugin-legacy`.
4. Select a `release` type. The default `next` creates the next patch for a stable version or advances an existing prerelease. Alternatively, select another supported release type or enter an exact `version`, which takes precedence over `release`.
5. Wait for the action to open a release PR against the target branch. The PR contains the selected package's version bump and changelog entry. A `create-vite` release also updates template Vite dependency versions when appropriate.

#### Review and Publish

1. Review the generated version and changelog, and wait for the release PR checks to pass.
2. Merge the PR while retaining its `release: <tag>` commit subject. Vite uses `release: v<version>`; other packages use `release: <package>@<version>`. A matching commit at the tip of `main` triggers the publish job.
2. Merge the PR while retaining its `release: <tag>` commit subject. Vite uses `release: v<version>`; other packages use `release: <package>@<version>`. A matching commit at the tip of `main` or a `v*` release branch triggers the publish job.
3. Open the [Publish Package](.github/workflows/publish.yml) run and approve its `Release` environment deployment.
4. Wait for the workflow to publish the package, create its tag, and create the corresponding GitHub release.
5. Verify the new version on npm.
Expand All @@ -368,7 +369,7 @@ All publishable packages in this repository use a pull-request-driven release fl

The release flow depends on configuration outside this repository:

- The `Release` environment must require maintainer approval before publishing.
- The `Release` environment must require maintainer approval before publishing and allow deployments from `main` and supported `v*` release branches.
- The npm trusted publishers for `vite`, `create-vite`, and `@vitejs/plugin-legacy` must be restricted to `vitejs/vite`, `.github/workflows/publish.yml`, and the `Release` environment.

#### Recovery
Expand Down