Skip to content

chore: remove deprectated (and unsupported) workflow runner types #81

chore: remove deprectated (and unsupported) workflow runner types

chore: remove deprectated (and unsupported) workflow runner types #81

Workflow file for this run

name: Bump Version
on:
pull_request:
types: [opened, reopened, labeled, synchronize]
jobs:
check_version_labels:
name: Bump Version
runs-on: medium
outputs:
run_reset: ${{ steps.reset_version.outputs.run_reset }}
if: |
contains(github.event.pull_request.labels.*.name, 'bump-patch-version') ||
contains(github.event.pull_request.labels.*.name, 'bump-minor-version') ||
contains(github.event.pull_request.labels.*.name, 'bump-major-version') ||
contains(github.event.pull_request.labels.*.name, 'reset-version')
steps:
- name: Checkout current branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
# By using this token instead of GITHUB_TOKEN, it should trigger other workflows
# after it.
#
# ************
# CAUTION
# ************
#
# ALLOWING WORKFLOWS TO TRIGGER OTHER WORKFLOWS CAN POTENTIALLY CREATE A LOOP!
# ALWAYS VERIFY THE ACTION YOU ARE CREATING DOES NOT HAVE THIS POSSIBILITY!
token: '${{ secrets.PAT }}'
- name: Set up Python 3.11.x
uses: actions/setup-python@v4
with:
python-version: 3.11.x
- uses: snok/install-poetry@v1
with:
virtualenvs-create: true
- name: Bump patch version
run: poetry version patch
if: contains(github.event.pull_request.labels.*.name, 'bump-patch-version')
- name: Bump minor version
run: poetry version minor
if: contains(github.event.pull_request.labels.*.name, 'bump-minor-version')
- name: Bump major version
run: poetry version major
if: contains(github.event.pull_request.labels.*.name, 'bump-major-version')
- name: Reset version number - trigger reset_version job
id: reset_version
run: echo "run_reset=True" >> $GITHUB_OUTPUT
if: contains(github.event.pull_request.labels.*.name, 'reset-version')
# Remove the label before we commit so that we don't cause a loop
- name: Remove label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: |
bump-patch-version
bump-minor-version
bump-major-version
- name: Commit changes
uses: EndBug/add-and-commit@v9
if: "!contains(github.event.pull_request.labels.*.name, 'reset-version')"
with:
message: ":bookmark: Bump version number"
committer_name: GitHub Actions
committer_email: [email protected]
add: 'pyproject.toml'
fetch: false
reset_version:
runs-on: 'medium'
needs: [check_version_labels]
if: needs.check_version_labels.outputs.run_reset == 'True'
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
ref: "main"
- name: Set up Python 3.11.x
uses: actions/setup-python@v4
with:
python-version: 3.11.x
- uses: snok/install-poetry@v1
with:
virtualenvs-create: true
- name: Get old version number
run: |
current_version=$(poetry version)
IFS=" " read -r -a version_str <<< "$current_version"
echo "new_version=${version_str[1]}" >> $GITHUB_ENV
- name: Checkout PR branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
# By using this token instead of GITHUB_TOKEN, it should trigger other workflows
# after it.
#
# ************
# CAUTION
# ************
#
# ALLOWING WORKFLOWS TO TRIGGER OTHER WORKFLOWS CAN POTENTIALLY CREATE A LOOP!
# ALWAYS VERIFY THE ACTION YOU ARE CREATING DOES NOT HAVE THIS POSSIBILITY!
token: '${{ secrets.PAT }}'
- name: Update version number
run: poetry version "${{ env.new_version }}"
# Remove the label before we commit so that we don't cause a loop
- name: Remove label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: reset-version
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: ":x: Reset version number"
committer_name: GitHub Actions
committer_email: [email protected]
add: 'pyproject.toml'
fetch: false