Skip to content

Commit

Permalink
ci: release workflow (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuchaobei authored May 24, 2023
1 parent 8b81fc9 commit 0f26902
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 6 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
@@ -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 }}
33 changes: 27 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}


0 comments on commit 0f26902

Please sign in to comment.