Draft new release #131
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Draft new release' | |
on: | |
workflow_dispatch: | |
inputs: | |
semver: | |
description: 'The version you want to release.' | |
required: true | |
type: choice | |
default: patch | |
options: | |
- major | |
- minor | |
- patch | |
- premajor | |
- preminor | |
- prepatch | |
- prerelease | |
jobs: | |
draft-new-release: | |
name: 'Draft a new release' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup bun environment | |
uses: oven-sh/setup-bun@v2 | |
- name: changelogen | |
run: | | |
bunx changelogen@latest --bump --${{ inputs.semver }} | |
- name: Get version from package.json | |
id: package-version | |
uses: martinbeentjes/[email protected] | |
- name: Create release branch | |
run: git checkout -b release/v${{ steps.package-version.outputs.current-version }} | |
- name: Initialize mandatory git config | |
run: | | |
git config user.name "GitHub actions" | |
git config user.email [email protected] | |
- name: Commit manifest files | |
id: make-commit | |
run: | | |
git add package.json CHANGELOG.md | |
git commit --message "Prepare release v${{ steps.package-version.outputs.current-version }}" | |
echo "::set-output name=commit::$(git rev-parse HEAD)" | |
- name: Push new branch | |
run: git push origin release/v${{ steps.package-version.outputs.current-version }} | |
- name: Create pull request | |
uses: thomaseizinger/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
head: release/v${{ steps.package-version.outputs.current-version }} | |
base: main | |
title: Release version v${{ steps.package-version.outputs.current-version }} | |
reviewers: ${{ github.actor }} # By default, we request a review from the person who triggered the workflow. | |
# Write a nice message to the user. | |
# We are claiming things here based on the `publish-new-release.yml` workflow. | |
# You should obviously adopt it to say the truth depending on your release workflow :) | |
body: | | |
Hi @${{ github.actor }}! | |
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}. | |
I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}. | |
Merging this PR will create a GitHub release and upload any assets that are created as part of the release build. |