@alanlu-dev/release-it-config

0.0.4 • Public • Published

@alanlu-dev/release-it-config

Version Downloads License

A release-it configuration for monorepo.

Installation

pnpm add -wD @alanlu-dev/release-it-config

Usage

Create a .release-it.cjs file in the root of your project:

module.exports = require('@alanlu-dev/release-it-config')

Add the following scripts to the package.json of the package:

{
  "scripts": {
    "release": "release-it --ci"
  }
}

Add the following scripts to the package.json in the root directory:

{
  "scripts": {
    "release": "turbo release --concurrency=1"
  }
}

CI/CD

You can use the following GitHub Actions workflow to automate the release process:

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/cache@v4.0.2
        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/ssh-key-action@v2.7.0
        with:
          key: ${{ secrets.SSH_KEY }}
          known_hosts: github.com

      - name: Run Release
        run: pnpm release --cache-dir=.turbo
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Readme

Keywords

none

Package Sidebar

Install

npm i @alanlu-dev/release-it-config

Weekly Downloads

83

Version

0.0.4

License

MIT

Unpacked Size

10.9 kB

Total Files

6

Last publish

Collaborators

  • u0124024