Skip to content

Create Release PR

Create Release PR #302

name: Create Release PR
on:
workflow_dispatch:
inputs:
override_version:
description:
'Override semver - can be used to bump minor and major versions'
type: string
required: false
jobs:
create-release-pr:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup CML
uses: iterative/setup-cml@v1
- name: Set Variables
id: set_variables
run: |
echo "last_release_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
echo "release_date=$(date --rfc-3339=date)" >> $GITHUB_OUTPUT
- name: Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configuration: .github/workflows/changelog-config.json
toTag: main
fromTag: ${{ steps.set_variables.outputs.last_release_tag }}
- name: Update Version
id: update_version
run: |
OVERRIDE_VERSION=${{ github.event.inputs.override_version }}
yarn workspace dvc version --new-version ${OVERRIDE_VERSION:-patch} --no-git-tag-version
echo "new_version=$(cat extension/package.json | jq -r .version)" >> $GITHUB_OUTPUT
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: '[${{ steps.update_version.outputs.new_version }}]'
release-notes: ${{ steps.build_changelog.outputs.changelog }}
release-date: ${{ steps.set_variables.outputs.release_date }}
- name: Create Pull Request
run: |
cml pr create \
--token="${{ secrets.GITHUB_TOKEN }}" \
--message="Update version and CHANGELOG for release" \
--title="Update version and CHANGELOG for release" \
--body='This PR updates the extension version and CHANGELOG.md.
Please close and reopen this PR to run the required workflows (Required statuses must pass before merging).
**The `publish` workflow will run automatically when this PR is merged.**
' .