monochange 0.6.6

Manage versions and releases for your multiplatform, multilanguage monorepo
Documentation
name: release

on:
  push:
    branches: [main]
  workflow_dispatch: {}

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

permissions:
  contents: write
  pull-requests: write
  id-token: write

jobs:
  release:
    timeout-minutes: 20
    runs-on: ubuntu-latest
    steps:
      - name: checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: install rust toolchain
        uses: dtolnay/rust-toolchain@stable

      - name: install cargo-binstall
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-binstall

      - name: install mc
        run: cargo binstall monochange --no-confirm

      - name: configure git
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

      - name: refresh tags from origin
        run: git fetch --force --tags origin

      - name: detect current release commit
        id: release_record
        shell: bash
        run: |
          set -euo pipefail

          if git diff-tree -m --no-commit-id --name-only -r HEAD | grep -q '^\.monochange/releases/.*/release\.json$'; then
            echo "is_release_commit=true" >> "$GITHUB_OUTPUT"
          else
            echo "is_release_commit=false" >> "$GITHUB_OUTPUT"
          fi

      - name: refresh release PR
        if: steps.release_record.outputs.is_release_commit != 'true'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          mc step:prepare-release --format markdown
          mc step:open-release-request --format markdown

      - name: create release tags
        if: steps.release_record.outputs.is_release_commit == 'true'
        run: mc step:tag-release --from HEAD

      - name: publish packages
        if: steps.release_record.outputs.is_release_commit == 'true'
        run: mc step:publish-packages