Skip to content

Update generate_changelog_and_version.yml #7

Update generate_changelog_and_version.yml

Update generate_changelog_and_version.yml #7

name: Commit Changelog And Version
on:
push:
branches:
- staging
jobs:
tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Bump version and push tag
id: autoversion
uses: anothrNick/github-tag-action@1.64.0
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
WITH_V: false
DRY_RUN: false
INITIAL_VERSION: 0.0.0
outputs:
new_tag: ${{ steps.autoversion.outputs.new_tag }}
commit_changelog_and_version:
needs: tag
runs-on: ubuntu-latest
name: Generate changelog and update version
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@main
id: git-cliff
with:
config: cliff.toml
args: --latest -t ${{ needs.tag.outputs.new_tag }}
env:
OUTPUT: CHANGES.md
- name: Copy changelog to workspace
run: echo "${{ steps.git-cliff.outputs.content }}" >> CHANGELOG.md
- name: Update blog version in config.toml
run: |
sed -i 's/"Version": "[0-9]*\.[0-9]*\.[0-9]*"/"Version": "${{ needs.tag.outputs.new_tag }}"/g' config.json
- name: Commit changes
if: ${{ success() }}
uses: EndBug/add-and-commit@v9
with:
add: '["CHANGELOG.md", "config.json"]'
pull: "--rebase --autostash ."
message: "chore(generated): changelog generated & version updated automatically"
default_author: github_actions