diff --git a/.github/workflows/publish_to_pypi.yaml b/.github/workflows/publish_to_pypi.yaml index a48320e2a..d73aeccb1 100644 --- a/.github/workflows/publish_to_pypi.yaml +++ b/.github/workflows/publish_to_pypi.yaml @@ -7,6 +7,8 @@ on: - master tags: - '*' + # Release Please dispatches this at the new tag; a tag it pushes starts no run by itself. + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -73,7 +75,7 @@ jobs: publish-testpypi: name: Publish wheels and source distribution to Test PyPI runs-on: ubuntu-24.04 - if: github.event_name == 'push' + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' permissions: id-token: write needs: @@ -97,7 +99,7 @@ jobs: publish-pypi: name: Publish wheels and source distribution to PyPI runs-on: ubuntu-24.04 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && !contains(github.ref, '-rc') + if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && startsWith(github.ref, 'refs/tags') && !contains(github.ref, '-rc') permissions: id-token: write needs: diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml new file mode 100644 index 000000000..d71b21c09 --- /dev/null +++ b/.github/workflows/release-please.yaml @@ -0,0 +1,33 @@ +# SPDX-FileCopyrightText: 2026 Institute for Automation of Complex Power Systems, EONERC, RWTH Aachen University +# SPDX-License-Identifier: MPL-2.0 + +name: Release Please + +on: + push: + branches: [master] + workflow_dispatch: + +permissions: + actions: write + contents: write + pull-requests: write + +jobs: + release-please: + name: Prepare Release + runs-on: ubuntu-latest + steps: + - id: release + uses: googleapis/release-please-action@v4 + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }} + target-branch: master + + # A tag pushed with GITHUB_TOKEN starts no workflow, but a dispatch always does. + - name: Start the publish pipeline + if: steps.release.outputs.release_created == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ steps.release.outputs.tag_name }} + run: gh workflow run publish_to_pypi.yaml --repo "${GITHUB_REPOSITORY}" --ref "${TAG}" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2163547fc..2014377fa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,4 +47,6 @@ repos: rev: "v0.13.0" hooks: - id: markdownlint + # CHANGELOG.md is generated by Release Please and trips MD012. + exclude: ^CHANGELOG\.md$ args: [-r, "~MD013,~MD033,~MD024"] diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 000000000..41ea87d76 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.2.1" +} diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bf0b1246..6089525d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Please keep 3.14 as minimum requirement for building on OPAL-RT targets cmake_minimum_required(VERSION 3.14...3.23) project(DPsim - VERSION 1.2.1 + VERSION 1.2.1 # x-release-please-version DESCRIPTION "C++ Power System Simulation Library" LANGUAGES CXX HOMEPAGE_URL "https://dpsim.fein-aachen.org/") diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 000000000..bb9e7fb82 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,71 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "release-type": "simple", + "changelog-sections": [ + { + "type": "feat", + "section": "Added" + }, + { + "type": "fix", + "section": "Fixed" + }, + { + "type": "perf", + "section": "Changed" + }, + { + "type": "refactor", + "section": "Changed" + }, + { + "type": "revert", + "section": "Removed" + }, + { + "type": "security", + "section": "Security" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "build", + "section": "Changed", + "hidden": true + }, + { + "type": "chore", + "section": "Changed", + "hidden": true + }, + { + "type": "ci", + "section": "Changed", + "hidden": true + }, + { + "type": "style", + "section": "Changed", + "hidden": true + }, + { + "type": "test", + "section": "Changed", + "hidden": true + } + ], + "packages": { + ".": { + "extra-files": [ + "CMakeLists.txt", + { + "type": "toml", + "path": "pyproject.toml", + "jsonpath": "$.project.version" + } + ] + } + } +}