Skip to content

Prepare new tag & changelog PR #10

Prepare new tag & changelog PR

Prepare new tag & changelog PR #10

Workflow file for this run

# @author Madhavan Sridharan
name: Prepare new tag & changelog PR
# runs on
# * manually triggered
on:
workflow_dispatch:
inputs:
release_type:
description: 'Type of version bump'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
# global env vars, available in all jobs and steps
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
new_tag_and_changelog:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Git config
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- name: Bump the tag version
id: create_branch
# --no-git-tag-version ensures we control when tags are pushed
# git fetch origin main
# git checkout -b release/bump-tag-version origin/main
run: |
npm version ${{ github.event.inputs.release_type }} -m "chore(release): bump tag version to %s"
# --follow-tags is not used when pushing the branch in the next step since we're using --no-git-tag-version here
# - name: Commit version bump
# run: |
# git add package.json
# git commit -m "chore(release): bump tag version to $(jq -r .version package.json)" || echo "No changes to commit"
# git push origin release/bump-tag-version
# Duplicate
# - name: Configure Git credentials
# run: |
# git config --global url."https://github.com/".insteadOf "[email protected]:"
# git config --global credential.helper store
# - name: Debug Git state
# run: |
# git remote -v
# git branch
# git config --list
- name: Generate changelog
continue-on-error: true
run: ./update_changelog.sh
- name: Create pull request
uses: peter-evans/create-pull-request@v7
env:
GITHUB_TOKEN:
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: "release/bump-tag-version"
#branch-suffix: "short-commit-hash"
base: "main"
title: "chore(release): Bump tag version and update changelog"
commit-message: "chore(release): Bump tag version and update changelog"
body: |
This pull request bumps the tag version to $(jq -r .version package.json) and updates changelog as part of the release process.
Please review and merge.