Using Github related tools

BOT

On Github, changesets provide a robot to detect whether the current Pull Request has changeset, and provide a UI interface to add and modify changeset.

Installation

Click link, select Install in the upper right corner, and confirm to complete the installation.

Configuration

After successful installation, you can enter the configuration page and select the application repository according to your needs.

Usage

After the configuration is completed, the robot will automatically check whether each Pull Request has added changeset and provide prompt information through reply.

No changeset added

You can run pnpm run change in the repository to add changeset, or click the second link below to fill in changeset directly.

Changeset added

You can click the link below to modify and add new changeset.

No need for changeset

You can directly ignore the prompt information when no changeset is added, which will not cause problems with the merging of Pull Requests.

Action

Automatically create Release Pull Request

Modern.js provides a Github Action to automatically create release Pull Request, which can automatically run bump command, update lock file and create Pull Request operation based on the selected branch.

Usage

  • Create a .github/workflows/release-pull-request.yml file in the repository and fill in the following content:
name: Release Pull Request

on:
  workflow_dispatch:
    inputs:
      version:
        type: choice
        description: 'Release Type(canary, beta, alpha, latest)'
        required: true
        default: 'latest'
        options:
        - canary
        - 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: 100

      - ... # install dependencies and build repo package
      - name: Create Release Pull Request
        uses: web-infra-dev/actions@v2
        with:
          version: ${{ github.event.inputs.version }}
          versionNumber: 'auto'
          type: 'pull request'
          tools: 'modern'
        env:
          GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
          REPOSITORY: ${{ github.repository }}
          REF: ${{ github.ref }}
  • After merging Workflow into the main branch, go to the Action page corresponding to the Github repository and select Release Pull Request:

Release Pull Request Action

  • Select the release type of this release, and click the Run workflow button:

Run Release Pull Request

  • After the workflow is completed, a Release-${version} Pull Request will be automatically created, the related version number of bump changeset will be automatically updated, and the lock file will be updated. The content of Pull Request is the Release Note automatically generated by running the gen-release-note command.

Release Pull Request

Automatic Release

Modern.js provides a Github Action to automatically release versions, which can automatically run release command based on the selected branch and publish the package to NPM.

Usage

  • Create a .github/workflows/release.yml file in the repository and fill in the following content:
name: Release

on:
  workflow_dispatch:
    inputs:
      version:
        type: choice
        description: 'Release Version(canary, beta, alpha, latest)'
        required: true
        default: 'next'
        options:
        - canary
        - beta
        - alpha
        - latest
      branch:
        description: 'Release Branch(confirm release branch)'
        required: true
        default: 'main'

jobs:
  release:
    name: Release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
        with:
          # This makes Actions fetch only one branch to release
          fetch-depth: 1

      - ... # install dependencies and build repo package
      - name: Release
        uses: web-infra-dev/actions@v2
        with:
          version: ${{ github.event.inputs.version }}
          branch: ${{ github.event.inputs.branch }}
          type: 'release'
          tools: 'modern'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
          REPOSITORY: ${{ github.repository }}
          REF: ${{ github.ref }}
  • Configure the NPM_TOKEN of the repository:

  • After merging Workflow into the main branch, go to the Action page corresponding to the Github repository and select Release:

Release Action

  • Select the branch name and release version type, and click the Run workflow button:

Run Release Action

  • Workflow will automatically complete the build and release to NPM process of the repository.