diff --git a/.github/workflows/release-pull-request.yml b/.github/workflows/release-pull-request.yml deleted file mode 100644 index 58fc48e8..00000000 --- a/.github/workflows/release-pull-request.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Release Pull Request - -on: - workflow_dispatch: - inputs: - version: - type: choice - description: 'Release Type (next, beta, alpha, latest)' - required: true - default: 'latest' - options: - - next - - beta - - alpha - - latest - -jobs: - release: - name: Create Release Pull Request - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@master - with: - # This makes Actions fetch only one branch to release - fetch-depth: 10 - - - name: Install Pnpm - run: corepack enable - - - name: Setup Node.js 18 - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'pnpm' - - - name: Install Dependencies - run: pnpm install --ignore-scripts - - - name: Create Release Pull Request - uses: web-infra-dev/actions@v2 - with: - # this expects you to have a script called release which does a build for your packages and calls changeset publish - version: ${{ github.event.inputs.version || 'latest' }} - versionNumber: 'auto' - type: 'pull request' - tools: 'changeset' - env: - GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - REPOSITORY: ${{ github.repository }} - REF: ${{ github.ref }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e5b12741..689a0b15 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dad34a40..5e40ae66 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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)