Skip to content

Commit

Permalink
chore: init release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 committed Aug 13, 2024
1 parent 3244725 commit 73e2a1c
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": false,
"commit": false,
"linked": [],
"access": "restricted",
"baseBranch": "main",
"fixed": [["@rslib/*"]],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true,
"updateInternalDependents": "always"
},
"updateInternalDependencies": "patch",
"ignore": []
}
48 changes: 48 additions & 0 deletions .github/workflows/release-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release Nightly

on:
workflow_dispatch:
# Nightly release disabled
# schedule:
# 00:00 AM Beijing Time.
# - cron: "0 16 * * *"

permissions:
# To publish packages with provenance
id-token: write

jobs:
release:
name: Release Nightly
if: github.repository == 'web-infra-dev/rslib'
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
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

- name: Release
uses: web-infra-dev/actions@v2
with:
version: nightly
branch: main
type: 'release'
tools: 'changeset'
env:
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
REPOSITORY: ${{ github.repository }}
REF: ${{ github.ref }}
53 changes: 53 additions & 0 deletions .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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
if: github.repository == 'web-infra-dev/rslib'
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 }}
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

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

permissions:
id-token: write

jobs:
release:
name: Release
if: github.repository == 'web-infra-dev/rslib' && github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 25

- 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

- name: Release
uses: web-infra-dev/actions@v2
with:
version: ${{ github.event.inputs.version }}
branch: ${{ github.event.inputs.branch }}
type: 'release'
tools: 'changeset'
env:
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
REPOSITORY: ${{ github.repository }}
REF: ${{ github.ref }}
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"name": "rslib-monorepo",
"private": true,
"workspaces": {
"packages": [
"packages/*"
]
},
"scripts": {
"build": "cross-env NX_DAEMON=false nx run-many -t build --exclude @examples/* --parallel=10",
"build:examples": "cross-env NX_DAEMON=false nx run-many -t build --projects @examples/* --parallel=10",
"change": "changeset",
"check-dependency-version": "check-dependency-version-consistency .",
"check-spell": "npx cspell",
"lint": "biome check . --diagnostic-level=warn && pnpm run check-spell",
Expand All @@ -29,6 +35,7 @@
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@changesets/cli": "^2.27.7",
"@modern-js/module-tools": "^2.55.0",
"@types/fs-extra": "^11.0.4",
"@types/node": "~18.19.39",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 73e2a1c

Please sign in to comment.