Skip to content

Commit

Permalink
Release tagging updates
Browse files Browse the repository at this point in the history
Signed-off-by: bvandekerkhof <[email protected]>
  • Loading branch information
bvandekerkhof committed Mar 13, 2024
1 parent e571a5f commit cfe5763
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 12 deletions.
14 changes: 14 additions & 0 deletions .github/get_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

import re

with open("pyproject.toml", "r") as file:
version_content = file.read()
# Match regex for <version="0.0.0a",> pattern
current_semantic_version = re.findall(r'version = "(\d+\.\d+\.[a-zA-Z0-9]+)"', version_content)
major_version, minor_version, patch_version = current_semantic_version[0].split(".")
patch_version = int(re.findall(r"\d+", patch_version)[0])
output_semantic_version = f"{major_version}.{minor_version}.{patch_version}"
print(output_semantic_version) # Print is required for release in GitHub action
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:
uses: sede-open/pyELQ/.github/workflows/sonarcloud_analysis.yml@main
needs: Tests
secrets: inherit
#
# ReleaseTag:
# uses: sede-open/pyELQ/.github/workflows/release_tagging.yml@main
# needs: [CodeFormat, Pydocstyle, Pylint, Tests]
# secrets: inherit

ReleaseTag:
uses: sede-open/pyELQ/.github/workflows/release_tagging.yml@main
needs: [CodeFormat, Pydocstyle]
secrets: inherit

Build:
uses: sede-open/pyELQ/.github/workflows/build_package.yml@main
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/manual_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# SPDX-FileCopyrightText: 2024 Shell Global Solutions International B.V. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0

name: ManualReleaseTag

on:
workflow_dispatch:

jobs:
# Releases new Python version
Release:
runs-on: ubuntu-latest
strategy:
matrix:
# Specify all python versions you might want to perform the actions on
python-version: [ "3.11" ]
steps:
# Checkout
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get version
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.PYELQ_TOKEN }}
id: version
run: |
version=$(python .github/get_version.py)
echo "BUMPED_VERSION=$(echo v$version)" >> $GITHUB_ENV
echo "New version: $version"
- name: Create Release
run: gh release create ${{ env.BUMPED_VERSION }} --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.PYELQ_TOKEN }}
9 changes: 2 additions & 7 deletions .github/workflows/release_tagging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,12 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Bump version and commit bumped version back to branch
- name: Get version
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.PYELQ_TOKEN }}
id: version
run: |
version=$(python .github/bump_version.py)
git config --global user.name 'bump_version'
git config --global user.email '[email protected]'
git remote set-url origin "https://[email protected]/$GITHUB_REPOSITORY"
git commit --signoff -am "Bumped minor version"
git push
version=$(python .github/get_version.py)
echo "BUMPED_VERSION=$(echo v$version)" >> $GITHUB_ENV
echo "New version: $version"
- name: Create Release
Expand Down

0 comments on commit cfe5763

Please sign in to comment.