Skip to content

Version bump

Version bump #4

Workflow file for this run

###########################################################################################################
#
# This job creates a version bump branch based on main, and opens a PR from it.
#
# The branch will have the version bumped in all necessary parts of the code,
# and it will generate the NEWS.md content from the NEWS snippets.
#
# Organization members have the chance to add or modify the commits on the branch, if necessary.
#
# The job will also generate a tarball, and reference it in the PR's description.
#
# The job cannot be started, if there is an open PR with the version given.
#
# Manual steps:
# 1. Navigate to https://github.com/axoflow/axosyslog/actions.
# 2. Choose the "Version bump" job.
# 3. Click "Run workflow".
# 4. Fill the new release version, and click "Run workflow".
# 5. When the PR is opened, double check the changes, if necessary, add commits.
# 6. When the PR is merged, the "Draft release" job will automatically start.
#
###########################################################################################################
name: Version bump
permissions: write-all
on:
workflow_dispatch:
inputs:
release_version:
description: 'VERSION (<MAJOR>.<MINOR>.<PATCH>)'
required: true
jobs:
version-bump:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.PAT_FOR_ACTIONS }}
RELEASE_VERSION: ${{ github.event.inputs.release_version }}
VERSION_BUMP_BRANCH: version/${{ github.event.inputs.release_version }}
CURRENT_RUN_URL: https://github.com/${{ github.repository_owner }}/axosyslog/actions/runs/${{ github.run_id }}
steps:
- name: Checkout AxoSyslog source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check existing PR
run: |
EXISTS=$(gh pr list --state open --head "${VERSION_BUMP_BRANCH}" --json "number" --jq ". | length")
if [ ${EXISTS} -ne 0 ]
then
echo "There is a PR already open for this version. Please close it before running this job."
exit 1
fi
- name: Configure git user
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Create git branch
run: |
git switch -c ${VERSION_BUMP_BRANCH}
- name: "DBLD: prepare-release"
run: |
./dbld/rules prepare-release VERSION=${RELEASE_VERSION}
git commit -a -s -m "version: bumped to ${RELEASE_VERSION}"
- name: Generate NEWS.md
run: |
./news/create-newsfile.py
git diff-index --quiet HEAD NEWS.md || git commit -a -s -m "NEWS: generate for ${RELEASE_VERSION}"
- name: "DBLD: release"
run: |
./dbld/rules release VERSION=${RELEASE_VERSION}
- name: Upload tarball
uses: actions/upload-artifact@v4
with:
name: axosyslog-${{ env.RELEASE_VERSION }}
path: dbld/release/${{ env.RELEASE_VERSION }}/axosyslog-${{ env.RELEASE_VERSION }}.tar.gz
- name: Open Pull Request
run: |
TITLE="Version: ${RELEASE_VERSION}"
DESCRIPTION="Tarball is available at: ${CURRENT_RUN_URL}"
git push --force origin ${VERSION_BUMP_BRANCH}
gh pr create \
--base "${GITHUB_REF}" \
--title "${TITLE}" \
--body "${DESCRIPTION}" \
--label "version-bump"