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 monochange
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: |
monochange step prepare-release --format markdown
monochange step open-release-request --format markdown
- name: create release tags
if: steps.release_record.outputs.is_release_commit == 'true'
run: monochange step tag-release --from HEAD
- name: publish packages
if: steps.release_record.outputs.is_release_commit == 'true'
run: monochange step publish-packages