From 06ac3743c3a95fd3476920beb35a73499316aace Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Fri, 23 Feb 2024 13:41:52 +0000 Subject: [PATCH 1/6] Add release_workflow.md, updt. release_action.yaml --- .github/release_workflow.md | 34 +++++++++++++++++++++++++++ .github/workflows/release_action.yaml | 12 ++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 .github/release_workflow.md diff --git a/.github/release_workflow.md b/.github/release_workflow.md new file mode 100644 index 000000000..422567229 --- /dev/null +++ b/.github/release_workflow.md @@ -0,0 +1,34 @@ +# Release Workflow + +This document outlines the release workflow for publishing to PyPI and TestPyPI using GitHub Actions. + +## Creating a New Release + +To create a new release, follow these steps: + +1. **Prepare the Release:** + - Create a new branch for the release (i.e. `v24.XX`) from `develop`. + - Increment the following: + - The version number in the `pyproject.toml` file following CalVer versioning. + - The`CHANGELOG.md` version with the changes for the new version. + - Open a PR to the `main` branch. Once the PR is merged, proceed to the next step. + +2. **Tag the Release:** + - Create a new Git tag for the release. For a full release, use a tag like `v24.2`. For a release candidate, use a tag like `v24.2-rc.1`. + - Push the tag to the remote repository: `git push origin `. + +3. **Create a GitHub Release:** + - Go to the "Releases" section of on GitHub. + - Click "Draft a new release." + - Enter the tag you created in the "Tag version" field. + - Fill in the release title and description. Add any major changes and link to the `CHANGELOG.md` for a list of total changes. + - If it's a pre-release (release candidate), check the "This is a pre-release" checkbox. + - Click "Publish release" to create the release. + +4. **Monitor the Workflow:** + - Go to the "Actions" tab of your repository to monitor the workflow's progress. + - The workflow will build the distribution packages and then publish them to PyPI or TestPyPI, depending on whether the release is a full release or a pre-release. + +5. **Verify the Release:** + - Check PyPI or TestPyPI to ensure that your package is available and has been updated to the new version. + - Test installing the package using `pip` to ensure everything works as expected. diff --git a/.github/workflows/release_action.yaml b/.github/workflows/release_action.yaml index 8cbaa5f4f..f346bb664 100644 --- a/.github/workflows/release_action.yaml +++ b/.github/workflows/release_action.yaml @@ -15,7 +15,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.8" + python-version: "3.12" - name: Install pypa/build run: >- python3 -m @@ -23,7 +23,7 @@ jobs: build --user - name: Build a binary wheel and a source tarball - run: python3 -m build + run: python -m build - name: Store the distribution packages uses: actions/upload-artifact@v3 with: @@ -36,8 +36,7 @@ jobs: if: > startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'rc') - needs: - - build + needs: build runs-on: ubuntu-latest environment: name: pypi @@ -53,6 +52,9 @@ jobs: path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} github-release: name: >- @@ -113,3 +115,5 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} From 6203269718e35efd8aaad6e2c821e913922e470c Mon Sep 17 00:00:00 2001 From: Brady Planden <55357039+BradyPlanden@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:57:00 +0000 Subject: [PATCH 2/6] Update .github/release_workflow.md Co-authored-by: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> --- .github/release_workflow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/release_workflow.md b/.github/release_workflow.md index 422567229..32a6a840a 100644 --- a/.github/release_workflow.md +++ b/.github/release_workflow.md @@ -14,7 +14,7 @@ To create a new release, follow these steps: - Open a PR to the `main` branch. Once the PR is merged, proceed to the next step. 2. **Tag the Release:** - - Create a new Git tag for the release. For a full release, use a tag like `v24.2`. For a release candidate, use a tag like `v24.2-rc.1`. + - Create a new Git tag for the release. For a full release, use a tag like `v24.2`. For a release candidate, use a tag like `v24.2rc.1`. - Push the tag to the remote repository: `git push origin `. 3. **Create a GitHub Release:** From 33645ae11acf18ab10799a0d6b068d9e3e6dc6d2 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Fri, 23 Feb 2024 15:25:09 +0000 Subject: [PATCH 3/6] remove API tokens --- .github/workflows/release_action.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/release_action.yaml b/.github/workflows/release_action.yaml index f346bb664..9eeb6e1bd 100644 --- a/.github/workflows/release_action.yaml +++ b/.github/workflows/release_action.yaml @@ -52,9 +52,6 @@ jobs: path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} github-release: name: >- @@ -115,5 +112,3 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} From a393d220430dc437df1e766f8aa5c5c0fa6ae048 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Fri, 23 Feb 2024 15:39:15 +0000 Subject: [PATCH 4/6] Add condition for main repository only on publish --- .github/workflows/release_action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_action.yaml b/.github/workflows/release_action.yaml index 9eeb6e1bd..12a0f5204 100644 --- a/.github/workflows/release_action.yaml +++ b/.github/workflows/release_action.yaml @@ -35,7 +35,7 @@ jobs: Publish Python 🐍 distribution 📦 to PyPI if: > startsWith(github.ref, 'refs/tags/') && - !contains(github.ref, 'rc') + !contains(github.ref, 'rc') && github.repository == github.event.repository needs: build runs-on: ubuntu-latest environment: @@ -90,7 +90,7 @@ jobs: publish-to-testpypi: name: Publish Python 🐍 distribution 📦 to TestPyPI - if: contains(github.ref, 'rc') # only publish to TestPyPI for rc tags + if: contains(github.ref, 'rc') && github.repository == github.event.repository # only publish to TestPyPI for rc tags needs: - build runs-on: ubuntu-latest From 8f3d66b2881185c8ab1fb3dda9dd7b4bf8a4b258 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Fri, 23 Feb 2024 16:16:46 +0000 Subject: [PATCH 5/6] Updt. Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 283dd7e6a..1690e8130 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Features +- [#215](https://github.com/pybop-team/PyBOP/pull/215) - Adds `release_workflow.md` and updates `release_action.yaml` - [#204](https://github.com/pybop-team/PyBOP/pull/204) - Splits integration, unit, examples, plots tests, update workflows. Adds pytest `--examples`, `--integration`, `--plots` args. Adds tests for coverage after removal of examples. Adds examples and integrations nox sessions. Adds `pybop.RMSE._evaluateS1()` method - [#206](https://github.com/pybop-team/PyBOP/pull/206) - Adds Python 3.12 support with corresponding github actions changes. - [#18](https://github.com/pybop-team/PyBOP/pull/18) - Adds geometric parameter fitting capability, via `model.rebuild()` with `model.rebuild_parameters`. From 1d9e190b20e3418333e31849759c59711d9546d7 Mon Sep 17 00:00:00 2001 From: Brady Planden Date: Fri, 23 Feb 2024 16:34:49 +0000 Subject: [PATCH 6/6] markdown format fix --- .github/release_workflow.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/release_workflow.md b/.github/release_workflow.md index 32a6a840a..5308083b0 100644 --- a/.github/release_workflow.md +++ b/.github/release_workflow.md @@ -7,28 +7,28 @@ This document outlines the release workflow for publishing to PyPI and TestPyPI To create a new release, follow these steps: 1. **Prepare the Release:** - - Create a new branch for the release (i.e. `v24.XX`) from `develop`. - - Increment the following: - - The version number in the `pyproject.toml` file following CalVer versioning. - - The`CHANGELOG.md` version with the changes for the new version. - - Open a PR to the `main` branch. Once the PR is merged, proceed to the next step. + - Create a new branch for the release (i.e. `v24.XX`) from `develop`. + - Increment the following; + - The version number in the `pyproject.toml` file following CalVer versioning. + - The`CHANGELOG.md` version with the changes for the new version. + - Open a PR to the `main` branch. Once the PR is merged, proceed to the next step. 2. **Tag the Release:** - - Create a new Git tag for the release. For a full release, use a tag like `v24.2`. For a release candidate, use a tag like `v24.2rc.1`. - - Push the tag to the remote repository: `git push origin `. + - Create a new Git tag for the release. For a full release, use a tag like `v24.2`. For a release candidate, use a tag like `v24.2rc.1`. + - Push the tag to the remote repository: `git push origin `. 3. **Create a GitHub Release:** - - Go to the "Releases" section of on GitHub. - - Click "Draft a new release." - - Enter the tag you created in the "Tag version" field. - - Fill in the release title and description. Add any major changes and link to the `CHANGELOG.md` for a list of total changes. - - If it's a pre-release (release candidate), check the "This is a pre-release" checkbox. - - Click "Publish release" to create the release. + - Go to the "Releases" section of on GitHub. + - Click "Draft a new release." + - Enter the tag you created in the "Tag version" field. + - Fill in the release title and description. Add any major changes and link to the `CHANGELOG.md` for a list of total changes. + - If it's a pre-release (release candidate), check the "This is a pre-release" checkbox. + - Click "Publish release" to create the release. 4. **Monitor the Workflow:** - - Go to the "Actions" tab of your repository to monitor the workflow's progress. - - The workflow will build the distribution packages and then publish them to PyPI or TestPyPI, depending on whether the release is a full release or a pre-release. + - Go to the "Actions" tab of your repository to monitor the workflow's progress. + - The workflow will build the distribution packages and then publish them to PyPI or TestPyPI, depending on whether the release is a full release or a pre-release. 5. **Verify the Release:** - - Check PyPI or TestPyPI to ensure that your package is available and has been updated to the new version. - - Test installing the package using `pip` to ensure everything works as expected. + - Check PyPI or TestPyPI to ensure that your package is available and has been updated to the new version. + - Test installing the package using `pip` to ensure everything works as expected.