diff --git a/.github/workflows/release-canary.yml b/.github/workflows/release-canary.yml deleted file mode 100644 index 7a9cac80..00000000 --- a/.github/workflows/release-canary.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Release - canary - -on: - push: - branches: - - main - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - release-canary: - runs-on: ubuntu-latest - permissions: - id-token: write - contents: write - if: | - github.repository == 'carbon-design-system/carbon-labs' - timeout-minutes: 60 - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - fetch-depth: '0' - - run: | - git config user.name carbon-bot - git config user.email carbon@us.ibm.com - - name: Use Node.js 18.x - uses: actions/setup-node@v4 - with: - node-version: '20.x' - cache: 'yarn' - - name: Install dependencies - run: yarn install - - name: Build project - run: yarn build - - name: Set NPM token - run: | - echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc - - name: Publish canary release of packages - run: | - yarn lerna publish --canary --preid canary --dist-tag canary --yes diff --git a/.github/workflows/release-deprecated.yml b/.github/workflows/release-deprecated.yml new file mode 100644 index 00000000..358edb93 --- /dev/null +++ b/.github/workflows/release-deprecated.yml @@ -0,0 +1,88 @@ +name: Release +run-name: + ${{ inputs.type }} - dry-run:${{ inputs.dry-run }} by @${{ github.actor }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + workflow_dispatch: + inputs: + 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 + +jobs: + release: + runs-on: ubuntu-latest + permissions: + id-token: write + contents: write + if: | + github.repository == 'carbon-design-system/carbon-labs' + timeout-minutes: 60 + env: + GH_TOKEN: ${{ secrets.MERGE_ACTION }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: '0' + - run: | + git config --global user.email ${{ secrets.CARBON_BOT_EMAIL }} + git config --global user.name ${{ secrets.CARBON_BOT_NAME }} + - name: Use Node.js 18.x + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'yarn' + - name: Install dependencies + run: yarn install + - name: Build project + run: yarn 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: Publish full minor release (ie. v1.x.0) + if: github.event.inputs.type == 'full minor release' + run: | + echo "DRY RUN: ${{ env.DRY_RUN }}" + yarn 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 }}" + yarn 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 }}" + yarn 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 }}" + yarn 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 }}" + yarn lerna publish --conventional-prerelease --preid rc --pre-dist-tag next $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}") diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 358edb93..12347651 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,31 +1,15 @@ name: Release -run-name: - ${{ inputs.type }} - dry-run:${{ inputs.dry-run }} by @${{ github.actor }} + +## on every merge to the main branch, lerna will publish a minor version for packages that have been modified +on: + push: + branches: + - main concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -on: - workflow_dispatch: - inputs: - 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 - jobs: release: runs-on: ubuntu-latest @@ -35,15 +19,13 @@ jobs: if: | github.repository == 'carbon-design-system/carbon-labs' timeout-minutes: 60 - env: - GH_TOKEN: ${{ secrets.MERGE_ACTION }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: '0' - run: | - git config --global user.email ${{ secrets.CARBON_BOT_EMAIL }} - git config --global user.name ${{ secrets.CARBON_BOT_NAME }} + git config user.name carbon-bot + git config user.email carbon@us.ibm.com - name: Use Node.js 18.x uses: actions/setup-node@v4 with: @@ -56,33 +38,6 @@ jobs: - 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: Publish full minor release (ie. v1.x.0) - if: github.event.inputs.type == 'full minor release' - run: | - echo "DRY RUN: ${{ env.DRY_RUN }}" - yarn 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 }}" - yarn 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 }}" - yarn 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 }}" - yarn 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' + - name: Publish minor release of packages run: | - echo "DRY RUN: ${{ env.DRY_RUN }}" - yarn lerna publish --conventional-prerelease --preid rc --pre-dist-tag next $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}") + yarn lerna publish minor --dist-tag latest --yes