Skip to content

Support for optional parameters (#297) #122

Support for optional parameters (#297)

Support for optional parameters (#297) #122

name: Bump version workflow
on:
push:
branches:
- master
# - main
jobs:
bump-version:
name: Bump package version
if: "!contains(github.event.head_commit.message, 'Bump version')"
runs-on: ubuntu-20.04
permissions: write-all
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
# contents: write
steps:
- name: checkout
uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bump2version
- name: Bump version
id: bump-version
run: |
git config --global user.email "[email protected]"
git config --global user.name "ODA Release Bot"
bump2version patch --verbose --commit --tag
bump2version release --verbose --commit --tag
echo "::set-output name=new_version::$(git describe --tags --abbrev=0)"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
id: cpr
with:
reviewers: "volodymyrss"
assignees: "volodymyrss"
title: "Bump version to ${{ steps.bump-version.outputs.new_version }}"
branch: "bump-version-${{ steps.bump-version.outputs.new_version }}"
body: |
Bump version to ${{ steps.bump-version.outputs.new_version }}
This PR was created automatically by the Bump version workflow.
- name: Enable Pull Request Automerge and Approve
run: |
gh pr edit --add-label "test-live" ${{ steps.cpr.outputs.pull-request-number }}
gh pr merge --merge --auto ${{ steps.cpr.outputs.pull-request-number }}
gh pr review --approve ${{ steps.cpr.outputs.pull-request-number }}
env:
GH_TOKEN: ${{ secrets.BOT_SECRET }}
publish-version:
name: Publish new package version
if: "contains(github.event.head_commit.message, 'Bump version')"
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
verify_metadata: false
password: ${{ secrets.PYPI_API_TOKEN }}