Skip to content

Commit

Permalink
chore(release): new release workflow for specific package
Browse files Browse the repository at this point in the history
  • Loading branch information
annawen1 committed Feb 7, 2024
1 parent 9b0328f commit 9e7fdd5
Showing 1 changed file with 116 additions and 0 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Release specific package
run-name:
${{ inputs.package }} ${{ inputs.type }} - dry-run:${{ inputs.dry-run }} by
@${{ github.actor }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
inputs:
package:
required: true
description: 'Specify the package'
type: choice
default:
options:
- chat
- extended-button
- utilities
type:
required: true
description: 'Specify the type of release'
type: choice
default: first minor rc
options:
- full minor release
- first minor rc
- full patch release
- first patch rc
- subsequent rc
dry-run:
required: true
description: 'Run dry run?'
type: boolean
default: true
force-publish:
required: true
description: 'Force publish?'
type: boolean
default: false

jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
if: |
github.repository == 'carbon-design-system/carbon-for-ai'
timeout-minutes: 60
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
fetch-depth: '0'
- run: |
git config user.name carbon-bot
git config user.email carbon@us.ibm.com
- uses: pnpm/action-setup@v2
with:
version: 8.9.2
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Go into specific package
run: cd packages/${{ github.event.inputs.package }}
- name: Build project
run: pnpm build
- name: Set NPM token
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc
- name: Set dry run env variable
run: |
if [ "${{ github.event.inputs.dry-run }}" == "false" ]; then
echo "DRY_RUN=--yes" >> $GITHUB_ENV
fi
- name: Set force publish env variable
run: |
if [ "${{ github.event.inputs.force-publish }}" == "true" ]; then
echo "FORCE_PUBLISH=--force-publish" >> $GITHUB_ENV
fi
- name: Publish full minor release (ie. v1.x.0)
if: github.event.inputs.type == 'full minor release'
run: |
echo "DRY RUN: ${{ env.DRY_RUN }}"
echo "FORCE_PUBLISH: ${{ env.FORCE_PUBLISH }}"
pnpm lerna publish minor --conventional-graduate $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}")
- name: Publish first minor RC (ie. v1.x.0-rc.0)
if: github.event.inputs.type == 'first minor rc'
run: |
echo "DRY RUN: ${{ env.DRY_RUN }}"
echo "FORCE_PUBLISH: ${{ env.FORCE_PUBLISH }}"
pnpm lerna publish preminor --conventional-prerelease --preid rc --pre-dist-tag next $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}")
- name: Publish full patch release (ie. v1.0.x)
if: github.event.inputs.type == 'full patch release'
run: |
echo "DRY RUN: ${{ env.DRY_RUN }}"
echo "FORCE_PUBLISH: ${{ env.FORCE_PUBLISH }}"
pnpm lerna publish patch --conventional-graduate $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}")
- name: Publish first patch RC (ie. v1.0.x-rc.0)
if: github.event.inputs.type == 'first patch rc'
run: |
echo "DRY RUN: ${{ env.DRY_RUN }}"
echo "FORCE_PUBLISH: ${{ env.FORCE_PUBLISH }}"
pnpm lerna publish prepatch --conventional-prerelease --preid rc --pre-dist-tag next $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}")
- name: Publish subsequent RC (ie. v1.0.0-rc.x)
if: github.event.inputs.type == 'subsequent rc'
run: |
echo "DRY RUN: ${{ env.DRY_RUN }}"
echo "FORCE_PUBLISH: ${{ env.FORCE_PUBLISH }}"
pnpm lerna publish --conventional-prerelease --preid rc --pre-dist-tag next $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}")

0 comments on commit 9e7fdd5

Please sign in to comment.