diff --git a/.github/workflows/release-pull-request.yml b/.github/workflows/release-pull-request.yml new file mode 100644 index 00000000..a7289df9 --- /dev/null +++ b/.github/workflows/release-pull-request.yml @@ -0,0 +1,54 @@ +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: + fetch-depth: 100 + + - name: Install Pnpm + run: corepack enable + + - name: Setup Node.js 16 + uses: actions/setup-node@v3 + with: + node-version: "16" + cache: 'pnpm' + + - name: Install Dependencies + run: pnpm install --ignore-scripts + + - name: Prepare Monorepo-Tools + run: pnpm run --filter @modern-js/monorepo-tools... build + + - 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 }} + versionNumber: 'auto' + type: 'pull request' + tools: 'modern' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_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 7cedca41..a351fba8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,9 +4,15 @@ on: workflow_dispatch: inputs: version: - description: 'Release Version(canary, pre, latest)' + type: choice + description: 'Release Type(next, beta, alpha, latest)' required: true - default: 'canary' + default: 'latest' + options: + - next + - beta + - alpha + - latest branch: description: 'Release Branch(confirm release branch)' required: true @@ -15,23 +21,38 @@ on: jobs: release: name: Release + if: ${{ github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@master + uses: actions/checkout@v3 with: # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits - fetch-depth: 0 + fetch-depth: 1 + + - name: Install Pnpm + run: corepack enable + + - name: Setup Node.js 16 + uses: actions/setup-node@v3 + with: + node-version: "16" + cache: 'pnpm' + + - name: Install Dependencies && Build + run: pnpm install - name: Release - uses: modern-js-dev/actions@main + 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 }} 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 }} + +