Skip to content

[MINOR] release workflows corrected also added publish workflows #27

[MINOR] release workflows corrected also added publish workflows

[MINOR] release workflows corrected also added publish workflows #27

Workflow file for this run

name: Release Drafter
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: write
jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
pull-requests: write
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- name: Draft Release
id: release_drafter
uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter.yml
publish: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure correct branch is checked out (only on PR)
if: github.event_name == 'pull_request'
run: |
echo "Checking out PR source branch: ${{ github.head_ref }}"
git fetch origin ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Update Changelog
run: |
VERSION="${{ steps.release_drafter.outputs.tag_name }}"
BODY="${{ steps.release_drafter.outputs.body }}"
# Create a new changelog entry file
echo -e "## ${VERSION} ($(date +'%Y-%m-%d'))\n\n${BODY}\n\n" > new_changelog_entry.md
# Prepend the new entry to the existing CHANGELOG.md
if [ -f CHANGELOG.md ]; then
cat CHANGELOG.md >> new_changelog_entry.md
fi
mv new_changelog_entry.md CHANGELOG.md
# Commits the updated CHANGELOG.md and creates a tag for the new version
- name: Commit and Push Changelog
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'docs: Update CHANGELOG.md for ${{ steps.release_drafter.outputs.tag_name }}'
file_pattern: 'CHANGELOG.md'
tagging_message: ${{ steps.release_drafter.outputs.tag_name }}