📦 Release patch/ by @wayjam #11
This file contains hidden or 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: 0x📦 Release New Version | |
run-name: 📦 Release ${{ inputs.semver }}/${{ inputs.custom_version }} by @${{ github.actor }} ${{ inputs.dry_run && '(🧪 Dry-Run)' || '' }} | |
on: | |
workflow_dispatch: | |
inputs: | |
semver: | |
type: choice | |
description: Which version you want to increment? | |
options: | |
- patch | |
- minor | |
- major | |
required: true | |
custom_version: | |
description: Manual Custom Version (Special Purpose, e.g. 1.0.0) | |
type: string | |
required: false | |
dry_run: | |
description: "Dry run?" | |
type: boolean | |
default: false | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
actions: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Calc Version | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
default_bump: ${{ inputs.semver }} | |
custom_tag: ${{ inputs.custom_version }} | |
dry_run: "true" | |
- name: Bump version and push tag | |
if: inputs.dry_run == false | |
run: | | |
# Configure Git | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
# Update package.json version | |
npm version ${{ steps.tag_version.outputs.new_version }} --no-git-tag-version | |
# Commit changes | |
git add package.json | |
git commit -m "release: bump version into ${{ steps.tag_version.outputs.new_tag }}" | |
git push | |
# Create and push tag | |
git tag ${{ steps.tag_version.outputs.new_tag }} | |
git push origin ${{ steps.tag_version.outputs.new_tag }} | |
- name: Create a GitHub release | |
if: inputs.dry_run == false | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
draft: ${{ inputs.dry_run }} | |
- name: Dispatch Build | |
uses: benc-uk/workflow-dispatch@v1 | |
if: inputs.dry_run == false | |
with: | |
workflow: publish.yaml |