diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c963947..7e851d7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Create release +name: Bump version, create release and deploy on: push: @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-latest outputs: tag: ${{ steps.semver.outputs.next }} + old_tag: ${{ steps.semver.outputs.current }} steps: - name: Checkout Code @@ -23,6 +24,18 @@ jobs: with: token: ${{ github.token }} branch: main + - name: Update __init__.py and pyproject.toml + run: | + replacev="\"${{steps.semver.outputs.next}}\"" + newtag=$(echo $replacev | sed "s/v//g") + sed -i "s/__version__ = .*/__version__ = $newtag/g" test_actions/__init__.py + + - name: Commit version change + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: main + commit_message: 'docs: bump version: ${{ steps.semver.outputs.current }} → ${{ github.ref_name }} [skip ci]' + file_pattern: test_actions/__init__.py - uses: rickstaa/action-create-tag@v1 id: "tag_create" @@ -40,20 +53,13 @@ jobs: with: fetch-depth: 0 - - name: Get previous tag - id: previousTag - run: | - name=$(git --no-pager tag --sort=creatordate --merged ${{ needs.bump.outputs.tag }} | tail -2 | head -1) - echo "previousTag: $name" - echo "previousTag=$name" >> $GITHUB_ENV - - name: Update CHANGELOG id: changelog uses: requarks/changelog-action@v1 with: token: ${{ github.token }} fromTag: ${{ needs.bump.outputs.tag }} - toTag: ${{ env.previousTag }} + toTag: ${{ needs.bump.outputs.old_tag }} - name: Create Release uses: ncipollo/release-action@v1.12.0 diff --git a/pyproject.toml b/pyproject.toml index 2c28e90..8390ab3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,8 +24,7 @@ test = [ dev = [ "pre-commit~=3.5", "black~=24.0", - "isort~=5.12", - "bump-my-version~=0.21" + "isort~=5.12" ] [tool.black] @@ -33,27 +32,3 @@ line-length = 100 [tool.isort] profile = "black" - -[tool.bumpversion] -current_version = "0.0.2" -parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)" -serialize = ["{major}.{minor}.{patch}"] -search = "{current_version}" -replace = "{new_version}" -regex = false -ignore_missing_version = false -tag = true -sign_tags = false -tag_name = "v{new_version}" -tag_message = "Bump version: {current_version} → {new_version}" -allow_dirty = false -commit = true -message = "Bump version: {current_version} → {new_version}" -commit_args = "--no-verify" - -[tool.bumpversion.parts.pre_l] -values = ["dev", "a", "b", "rc", "final"] -optional_value = "final" - -[[tool.bumpversion.files]] -filename = "test_actions/__init__.py" diff --git a/test_actions/__init__.py b/test_actions/__init__.py index 8bd8db9..4827889 100644 --- a/test_actions/__init__.py +++ b/test_actions/__init__.py @@ -2,4 +2,4 @@ Test python package to test Github actions """ -__version__ = "0.0.2" +__version__ = "1.0.1"