From d4b328775e21fc6e34cd0b3a7886f71de16a3522 Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Tue, 21 May 2024 07:58:36 +0000 Subject: [PATCH 1/7] test semantic versioning --- .github/semver.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/semver.yml b/.github/semver.yml index a351a3d..5d7d05c 100644 --- a/.github/semver.yml +++ b/.github/semver.yml @@ -1,9 +1,8 @@ -# .github/workflows/release.yml -name: Release +name: Semantic Versioning -on: - pull_request: - types: [closed] +on: push + # pull_request: + # types: [closed] jobs: build: @@ -17,6 +16,5 @@ jobs: with: release_branch: pyproject.toml release_strategy: none - env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} From 952594929bb57e41f811534396d2786072f5a074 Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Tue, 21 May 2024 07:59:40 +0000 Subject: [PATCH 2/7] moved to workflow folder --- .github/{ => workflows}/semver.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/semver.yml (100%) diff --git a/.github/semver.yml b/.github/workflows/semver.yml similarity index 100% rename from .github/semver.yml rename to .github/workflows/semver.yml From f522d76605ec8f7d4a83fc4fb35b7e362343d3f5 Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Tue, 21 May 2024 08:00:20 +0000 Subject: [PATCH 3/7] test ci --- .github/workflows/semver.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml index 5d7d05c..0c357a2 100644 --- a/.github/workflows/semver.yml +++ b/.github/workflows/semver.yml @@ -8,7 +8,7 @@ jobs: build: runs-on: ubuntu-latest - if: github.event.pull_request.merged + # if: github.event.pull_request.merged steps: - name: Tag From 759732f9538af88d3bda0d082e1f18f62791d1e9 Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Tue, 21 May 2024 08:02:24 +0000 Subject: [PATCH 4/7] removed checks --- .github/workflows/semver.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml index 0c357a2..bddcdf0 100644 --- a/.github/workflows/semver.yml +++ b/.github/workflows/semver.yml @@ -6,15 +6,12 @@ on: push jobs: build: - runs-on: ubuntu-latest - - # if: github.event.pull_request.merged - + runs-on: ubuntu-latest steps: - name: Tag uses: K-Phoen/semver-release-action@master with: - release_branch: pyproject.toml + release_branch: test_semver release_strategy: none env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} From 932fc5dfb69d60d13040cf1422ee07a52911a0df Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Tue, 21 May 2024 08:42:13 +0000 Subject: [PATCH 5/7] make my own version bumper --- .github/workflows/semver.yml | 53 ++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml index bddcdf0..fbe4acb 100644 --- a/.github/workflows/semver.yml +++ b/.github/workflows/semver.yml @@ -1,17 +1,46 @@ -name: Semantic Versioning +name: Semantic Versioning for Tags -on: push - # pull_request: - # types: [closed] +on: + push: + branches: + - test_semserver jobs: - build: - runs-on: ubuntu-latest + bump-version: + runs-on: ubuntu-latest steps: - - name: Tag - uses: K-Phoen/semver-release-action@master + - name: Checkout Repository + uses: actions/checkout@v4 with: - release_branch: test_semver - release_strategy: none - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + fetch-depth: 0 + + - name: Bump Version and Tag + run: | + # Fetch the latest tags from the remote + git fetch --tags + + # Get the latest tag + latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`) + + # Split the latest tag into parts + IFS='.' read -r -a parts <<< "${latest_tag#v}" + + # Increment the patch version + major=${parts[0]} + minor=${parts[1]} + patch=${parts[2]} + new_patch=$((patch + 1)) + + # Create a new tag + new_tag="v$major.$minor.$new_patch" + + echo "Bumping version from $latest_tag to $new_tag" + + # Tag the new version + git tag $new_tag + + # Configure GitHub token authentication + git remote set-url origin https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git + + # Push the new tag to the remote repository + git push origin $new_tag From e2d1deefdb970465a40d1fd3f68c5d4444d4b5dd Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Tue, 21 May 2024 08:43:04 +0000 Subject: [PATCH 6/7] select branch --- .github/workflows/semver.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml index fbe4acb..1c93b78 100644 --- a/.github/workflows/semver.yml +++ b/.github/workflows/semver.yml @@ -3,7 +3,7 @@ name: Semantic Versioning for Tags on: push: branches: - - test_semserver + - test_semver jobs: bump-version: From cd0b66c0b85029b1a8fa1d3b98ba860ea4385dd6 Mon Sep 17 00:00:00 2001 From: "Schmieder, Jacob" Date: Tue, 21 May 2024 08:56:28 +0000 Subject: [PATCH 7/7] now just runs on merge to main --- .github/workflows/semver.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/semver.yml b/.github/workflows/semver.yml index 1c93b78..c6d5fb1 100644 --- a/.github/workflows/semver.yml +++ b/.github/workflows/semver.yml @@ -1,12 +1,14 @@ name: Semantic Versioning for Tags on: - push: + pull_request: + types: [closed] branches: - - test_semver + - main jobs: bump-version: + if: ${{ github.event.pull_request.merged == true $$ github.event.pull_request.base.ref == 'main' }} runs-on: ubuntu-latest steps: - name: Checkout Repository