Skip to content

Merge pull request #16 from tawanda-kembo/feat/automate-versioning #16

Merge pull request #16 from tawanda-kembo/feat/automate-versioning

Merge pull request #16 from tawanda-kembo/feat/automate-versioning #16

name: Tag and Release
on:
push:
branches:
- main
jobs:
tag-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- name: Set up Git
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
- name: Bump version and push tag
id: bump_version
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
./bump_version.sh
echo "NEW_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
- name: Generate Release Notes
id: generate_notes
run: |
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --always HEAD^)
NOTES=$(git log ${PREVIOUS_TAG}..HEAD --pretty=format:"* %s" --reverse)
echo "RELEASE_NOTES<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.bump_version.outputs.NEW_VERSION }}
name: Release ${{ steps.bump_version.outputs.NEW_VERSION }}
body: |
Changes in this Release:
${{ steps.generate_notes.outputs.RELEASE_NOTES }}
For full details, see [CHANGELOG](https://github.com/tawanda-kembo/code-collator/blob/main/CHANGELOG.md).
draft: false
prerelease: false
token: ${{ secrets.PAT_TOKEN }}