-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(release-it-config): update README.md
- Loading branch information
1 parent
143597d
commit 7f49eb0
Showing
2 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ Indrek | |
indrekpaas | ||
Paas | ||
Riethmuller's | ||
shimataro | ||
vogelino |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,113 @@ | |
</p> | ||
|
||
A release-it configuration for monorepo. | ||
|
||
## Installation | ||
|
||
```bash | ||
pnpm add -wD @alanlu-dev/release-it-config | ||
``` | ||
|
||
## Usage | ||
|
||
Create a `.release-it.cjs` file in the root of your project: | ||
|
||
```js | ||
module.exports = require('@alanlu-dev/release-it-config') | ||
``` | ||
|
||
Add the following scripts to the `package.json` of the package: | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"release": "release-it --ci" | ||
} | ||
} | ||
``` | ||
|
||
Add the following scripts to the `package.json` in the root directory: | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"release": "turbo release --concurrency=1" | ||
} | ||
} | ||
``` | ||
|
||
## CI/CD | ||
|
||
You can use the following GitHub Actions workflow to automate the release process: | ||
|
||
```yaml | ||
name: Release & Publish | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: main | ||
|
||
permissions: {} | ||
jobs: | ||
release: | ||
name: Release | ||
permissions: | ||
contents: write # to create release (changesets/action) | ||
timeout-minutes: 20 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/action-setup@v3 | ||
|
||
- name: Use Node.js 20 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: pnpm | ||
|
||
- name: Setup turbo cache | ||
uses: actions/[email protected] | ||
with: | ||
path: .turbo | ||
key: turbo-${{ github.ref_name }}-${{ github.sha }} | ||
restore-keys: | | ||
turbo-${{ github.ref_name }}- | ||
turbo-main- | ||
- name: Install deps | ||
if: steps.node-cache.outputs.cache-hit != 'true' | ||
run: pnpm install --prefer-offline --frozen-lockfile | ||
|
||
- name: Build | ||
run: pnpm run build | ||
|
||
- name: Setup git user | ||
run: | | ||
git config user.name "$GIT_USER_NAME" | ||
git config user.email "$GIT_USER_EMAIL" | ||
env: | ||
GIT_USER_NAME: ${{ vars.GIT_USER_NAME }} | ||
GIT_USER_EMAIL: ${{ vars.GIT_USER_EMAIL }} | ||
|
||
- name: Setup npm auth | ||
run: echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc | ||
env: | ||
NPM_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} | ||
|
||
- name: Setup ssh key | ||
uses: shimataro/[email protected] | ||
with: | ||
key: ${{ secrets.SSH_KEY }} | ||
known_hosts: github.com | ||
|
||
- name: Run Release | ||
run: pnpm release --cache-dir=.turbo | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
``` |