From 6bc26ae8cef5b705cb162ea4ab9f8ba196e91933 Mon Sep 17 00:00:00 2001 From: Stephanie Kemna <6518317+StephanieKemna@users.noreply.github.com> Date: Wed, 25 Jun 2025 12:48:01 +0200 Subject: [PATCH 1/6] try to ensure that bump-my-version does not commit directly, and that the right permissions are in place to do the PR --- .github/workflows/bump-my-version.yml | 7 +++++-- pyproject.toml | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bump-my-version.yml b/.github/workflows/bump-my-version.yml index 6789244..4197fa6 100644 --- a/.github/workflows/bump-my-version.yml +++ b/.github/workflows/bump-my-version.yml @@ -17,6 +17,9 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: # notify if someone is trying to run this from any other branch than `release` - name: Ensure on release branch @@ -43,7 +46,7 @@ jobs: BUMPVERSION_TAG: "false" with: args: ${{ inputs.bump-type }} - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.RELEASE_TOKEN }} - name: Check if: steps.bump.outputs.bumped == 'true' @@ -59,4 +62,4 @@ jobs: body: "Automated version bump PR" base: release delete-branch: true - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.RELEASE_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 4de007a..7db2c99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -170,12 +170,12 @@ search = "{current_version}" replace = "{new_version}" regex = false ignore_missing_version = false -tag = true +tag = false sign_tags = false tag_name = "v{new_version}" tag_message = "Bump version: {current_version} → {new_version}" allow_dirty = false -commit = true +commit = false message = "Bump version: {current_version} → {new_version}" commit_args = "" From 1f0adfdddc97c9c6727b46f2b9671f34a8468ec3 Mon Sep 17 00:00:00 2001 From: Stephanie Kemna <6518317+StephanieKemna@users.noreply.github.com> Date: Wed, 25 Jun 2025 12:49:37 +0200 Subject: [PATCH 2/6] reverse to using github token, not release token --- .github/workflows/bump-my-version.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump-my-version.yml b/.github/workflows/bump-my-version.yml index 4197fa6..6aaa234 100644 --- a/.github/workflows/bump-my-version.yml +++ b/.github/workflows/bump-my-version.yml @@ -46,7 +46,7 @@ jobs: BUMPVERSION_TAG: "false" with: args: ${{ inputs.bump-type }} - github-token: ${{ secrets.RELEASE_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Check if: steps.bump.outputs.bumped == 'true' @@ -62,4 +62,4 @@ jobs: body: "Automated version bump PR" base: release delete-branch: true - token: ${{ secrets.RELEASE_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} From c647006eaeab1ea3f8f2b0e665062b6093b192e9 Mon Sep 17 00:00:00 2001 From: StephanieKemna <6518317+StephanieKemna@users.noreply.github.com> Date: Wed, 25 Jun 2025 10:50:52 +0000 Subject: [PATCH 3/6] =?UTF-8?q?Bump=20version:=201.0.2=20=E2=86=92=201.0.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- docs/source/conf.py | 2 +- pyproject.toml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6f8d35..637cb4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to the [mlfmu] project will be documented in this file.
The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## Unreleased +## [1.0.3] ### Changed diff --git a/docs/source/conf.py b/docs/source/conf.py index a326fd9..7c52bf8 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -26,7 +26,7 @@ author = "Kristoffer Skare, Jorge Luis Mendez, Stephanie Kemna, Melih Akdag" # The full version, including alpha/beta/rc tags -release = "1.0.2" +release = "1.0.3" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/pyproject.toml b/pyproject.toml index 7db2c99..365df17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ packages = [ [project] name = "mlfmu" -version = "1.0.2" +version = "1.0.3" description = "Export ML models represented as ONNX files to Functional-Mockup-Units (FMU)" readme = "README.md" requires-python = ">= 3.10,<3.13" @@ -163,7 +163,7 @@ reportUnnecessaryTypeIgnoreComment = "information" [tool.bumpversion] -current_version = "1.0.2" +current_version = "1.0.3" parse = "(?P\\d+)\\.(?P\\d+)\\.(?P\\d+)" serialize = ["{major}.{minor}.{patch}"] search = "{current_version}" From fda2a075cb75744704bff4e9d8ba020f42351db7 Mon Sep 17 00:00:00 2001 From: Stephanie Kemna <6518317+StephanieKemna@users.noreply.github.com> Date: Wed, 25 Jun 2025 12:58:07 +0200 Subject: [PATCH 4/6] only create the tag if it does not already exist --- .github/workflows/push_to_release.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push_to_release.yml b/.github/workflows/push_to_release.yml index 9849e07..a7059cf 100644 --- a/.github/workflows/push_to_release.yml +++ b/.github/workflows/push_to_release.yml @@ -40,10 +40,16 @@ jobs: echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Create tag run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git tag v${{ steps.get_version.outputs.version }} - git push origin v${{ steps.get_version.outputs.version }} + TAG="v${{ steps.get_version.outputs.version }}" + if git rev-parse "$TAG" >/dev/null 2>&1; then + echo "Tag $TAG already exists. Skipping tag creation." + exit 0 + else + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag "$TAG" + git push origin "$TAG" + fi outputs: version: ${{ steps.get_version.outputs.version }} From 241ec1c04c4a9d18ef3fde6577abd326a482c6ab Mon Sep 17 00:00:00 2001 From: Stephanie Kemna <6518317+StephanieKemna@users.noreply.github.com> Date: Wed, 25 Jun 2025 13:09:08 +0200 Subject: [PATCH 5/6] try if create_release will work by passing token explicitly --- .github/workflows/push_to_release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/push_to_release.yml b/.github/workflows/push_to_release.yml index a7059cf..5eb29b5 100644 --- a/.github/workflows/push_to_release.yml +++ b/.github/workflows/push_to_release.yml @@ -93,3 +93,5 @@ jobs: release_name: Release v${{ needs.create_tag.outputs.version }} draft: false prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 4863ea9bbeef9267d0131da5ba00f670d2ed226c Mon Sep 17 00:00:00 2001 From: Stephanie Kemna <6518317+StephanieKemna@users.noreply.github.com> Date: Wed, 25 Jun 2025 13:22:30 +0200 Subject: [PATCH 6/6] new file for github release so it can be run separately, update README with new recommended steps --- .github/workflows/_create_github_release.yml | 29 ++++++++++++++++++++ .github/workflows/push_to_release.yml | 15 +++------- README.md | 11 +++++++- 3 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/_create_github_release.yml diff --git a/.github/workflows/_create_github_release.yml b/.github/workflows/_create_github_release.yml new file mode 100644 index 0000000..3d6b271 --- /dev/null +++ b/.github/workflows/_create_github_release.yml @@ -0,0 +1,29 @@ +on: + workflow_call: + inputs: + version: + description: 'Version to release' + required: true + type: string + workflow_dispatch: + inputs: + version: + description: 'Version to release' + required: true + type: string + +jobs: + # create github release + create_release: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/create-release@v1 + with: + tag_name: v${{ inputs.version }} + release_name: Release v${{ inputs.version }} + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/push_to_release.yml b/.github/workflows/push_to_release.yml index 5eb29b5..da1b535 100644 --- a/.github/workflows/push_to_release.yml +++ b/.github/workflows/push_to_release.yml @@ -82,16 +82,9 @@ jobs: # with: # repository-url: https://test.pypi.org/legacy/ - # create github release create_release: + name: Create GitHub Release needs: [create_tag, publish_package] - runs-on: ubuntu-latest - steps: - - uses: actions/create-release@v1 - with: - tag_name: v${{ needs.create_tag.outputs.version }} - release_name: Release v${{ needs.create_tag.outputs.version }} - draft: false - prerelease: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: ./.github/workflows/_create_github_release.yml + with: + version: ${{ needs.create_tag.outputs.version }} diff --git a/README.md b/README.md index 499efe1..ef01e29 100644 --- a/README.md +++ b/README.md @@ -320,7 +320,16 @@ Hee Jong Park - [@LinkedIn](https://www.linkedin.com/in/heejongpark/) -