Skip to content

Commit

Permalink
docs(release-it-config): update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlu-zyl committed Apr 21, 2024
1 parent 143597d commit 7f49eb0
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
1 change: 1 addition & 0 deletions .vscode/.cspell/name.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Indrek
indrekpaas
Paas
Riethmuller's
shimataro
vogelino
110 changes: 110 additions & 0 deletions packages/release-it-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
```

0 comments on commit 7f49eb0

Please sign in to comment.