Skip to content

Commit

Permalink
chore(workflow): update release workflow (#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Jan 7, 2025
1 parent 8e840e1 commit 372f497
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 90 deletions.
52 changes: 0 additions & 52 deletions .github/workflows/release-pull-request.yml

This file was deleted.

50 changes: 25 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,57 @@ name: Release
on:
workflow_dispatch:
inputs:
version:
npm_tag:
type: choice
description: 'Release Version (next, beta, alpha, latest)'
description: 'Specify npm tag'
required: true
default: 'next'
default: 'alpha'
options:
- next
- beta
- alpha
- beta
- rc
- canary
- latest
branch:
description: 'Release Branch (confirm release branch)'
required: true
default: 'main'

permissions:
# Provenance generation in GitHub Actions requires "write" access to the "id-token"
id-token: write

jobs:
release:
name: Release
if: ${{ github.event_name == 'workflow_dispatch' }}
if: github.repository == 'web-infra-dev/rsdoctor' && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v4.2.2
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
fetch-depth: 25
fetch-depth: 1
ref: ${{ github.event.inputs.branch }}

- name: Install Pnpm
run: corepack enable

- name: Setup Node.js 18
uses: actions/setup-node@v4
- name: Setup Node.js
uses: actions/setup-node@v4.1.0
with:
node-version: '18'
node-version: 22
cache: 'pnpm'

- name: Install npm v9
run: npm install -g npm@9
- name: Install Pnpm
run: corepack enable

- name: Install Dependencies
run: pnpm install

- name: Release
uses: web-infra-dev/actions@v2
with:
version: ${{ github.event.inputs.version }}
branch: ${{ github.event.inputs.branch }}
type: 'release'
tools: 'changeset'
- name: Publish to npm
env:
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
REPOSITORY: ${{ github.repository }}
REF: ${{ github.ref }}
NPM_TOKEN: ${{ secrets.RSDOCTOR_NPM_TOKEN }}
run: |
npm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}"
pnpm -r publish --tag ${{ github.event.inputs.npm_tag }} --publish-branch ${{ github.event.inputs.branch }}
20 changes: 7 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,13 @@ Dependencies installation-related metrics base on publishing process, so the dat

---

## Versioning

We use [changesets](https://github.com/changesets/changesets) to manage version. Currently, all Rsbuild packages will use a fixed unified version.

The release notes are automatically generated by [GitHub releases](https://github.com/web-infra-dev/rsbuild/releases).

## Releasing

Repository maintainers can publish a new version of all packages to npm.

Here are the steps to publish (we generally use CI for releases and avoid publishing npm packages locally):
Repository maintainers can publish a new version of changed packages to npm.

1. [Create release pull request](https://github.com/web-infra-dev/rsbuild/actions/workflows/release-pull-request.yml).
2. [Run the release action](https://github.com/web-infra-dev/rsbuild/actions/workflows/release.yml).
3. [Generate the release notes](https://github.com/web-infra-dev/rsbuild/releases).
4. Merge the release pull request.
1. Checkout a new release branch, for example `release_v1.2.0`
2. Run [changesets](https://github.com/changesets/changesets) to bump changed packages and commit the changes.
3. Create a pull request, the title should be `release: v1.2.0`.
4. Run the [release action](https://github.com/web-infra-dev/rsbuild/actions/workflows/release.yml) to publish packages to npm.
5. Merge the release pull request to `main`.
6. Generate the [release notes](https://github.com/web-infra-dev/rsbuild/releases) via GitHub, see [Automatically generated release notes](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes)

0 comments on commit 372f497

Please sign in to comment.