From e36c7469b77ed0ddf300478effb272fe9c0c8bcb Mon Sep 17 00:00:00 2001 From: David Ittah Date: Wed, 17 Jul 2024 11:48:18 -0400 Subject: [PATCH 1/5] Add dev version number --- pennylane/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pennylane/_version.py b/pennylane/_version.py index d083e43a1e0..b793ff83946 100644 --- a/pennylane/_version.py +++ b/pennylane/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.38.0-dev" +__version__ = "0.38.0-dev0" From 1f99561a766dc35ce395b64281abf282bb1d60f3 Mon Sep 17 00:00:00 2001 From: David Ittah Date: Wed, 17 Jul 2024 11:48:31 -0400 Subject: [PATCH 2/5] Add version bump script --- .../workflows/scripts/set_nightly_version.py | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/scripts/set_nightly_version.py diff --git a/.github/workflows/scripts/set_nightly_version.py b/.github/workflows/scripts/set_nightly_version.py new file mode 100644 index 00000000000..76cf4810649 --- /dev/null +++ b/.github/workflows/scripts/set_nightly_version.py @@ -0,0 +1,43 @@ +# Copyright 2024 Xanadu Quantum Technologies Inc. + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +This module bumps the PennyLane development version by one unit. +""" + +import os +import re + +version_file_path = os.path.join(os.path.dirname(__file__), "../../../pennylane/_version.py") + +assert os.path.isfile(version_file_path) + +with open(version_file_path, "r+", encoding="UTF-8") as f: + lines = f.readlines() + + version_line = lines[-1] + assert "__version__ = " in version_line + + pattern = r"(\d+).(\d+).(\d+)-dev(\d+)" + match = re.search(pattern, version_line) + assert match + + major, minor, bug, dev = match.groups() + + replacement = f'__version__ = "{major}.{minor}.{bug}-dev{int(dev)+1}"\n' + lines[-1] = replacement + + f.seek(0) + f.writelines(lines) + f.truncate() From 1cefe307f5c16e13eea73a11031ef1c247b3f31c Mon Sep 17 00:00:00 2001 From: David Ittah Date: Wed, 17 Jul 2024 11:48:56 -0400 Subject: [PATCH 3/5] Add nightly release action Requires trusted publishing to be setup. --- .github/workflows/upload-nightly-release.yaml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/upload-nightly-release.yaml diff --git a/.github/workflows/upload-nightly-release.yaml b/.github/workflows/upload-nightly-release.yaml new file mode 100644 index 00000000000..6f33c22ad37 --- /dev/null +++ b/.github/workflows/upload-nightly-release.yaml @@ -0,0 +1,47 @@ +name: Build nightly PennyLane releases for TestPyPI + +on: + schedule: + # Run every weekday at 23:40 EDT (cron is in UTC) + - cron: "40 3 * * 2-6" + workflow_dispatch: + +jobs: + setup: + name: Setup the release + runs-on: ubuntu-latest + steps: + - name: Checkout PennyLane repo + uses: actions/checkout@v4 + with: + ssh-key: ${{ secrets.NIGHTLY_VERSION_UPDATE_DEPLOY_KEY }} + + - name: Bump dev version + run: | + python $GITHUB_WORKSPACE/.github/workflows/scripts/set_nightly_version.py + + - name: Push new version + run: | + git config --global user.email '${{ secrets.AUTO_UPDATE_VERSION_RINGO_EMAIL }}' + git config --global user.name "ringo-but-quantum" + git add $GITHUB_WORKSPACE/pennylane/_version.py + git commit -m "[no ci] bump nightly version" + git push + + upload: + name: Upload wheels to TestPyPI + needs: [setup] + runs-on: ubuntu-latest + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Build wheels + run: | + python setup.py bdist_wheel --dist-dir dist + + - name: Upload wheels + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + packages-dir: dist From fe1a4f8cd9ac0cfefc4981626c0a7c8c0f214ad0 Mon Sep 17 00:00:00 2001 From: Alex Preciado Date: Thu, 25 Jul 2024 12:38:50 -0400 Subject: [PATCH 4/5] Move workflow from .yaml to .yml file --- .../{upload-nightly-release.yaml => upload-nightly-release.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{upload-nightly-release.yaml => upload-nightly-release.yml} (100%) diff --git a/.github/workflows/upload-nightly-release.yaml b/.github/workflows/upload-nightly-release.yml similarity index 100% rename from .github/workflows/upload-nightly-release.yaml rename to .github/workflows/upload-nightly-release.yml From 95ad665341e80c44a4f5feb1e985bdd0c27316b8 Mon Sep 17 00:00:00 2001 From: David Ittah Date: Thu, 25 Jul 2024 16:57:42 -0400 Subject: [PATCH 5/5] Update schedule & wheel build method --- .github/workflows/upload-nightly-release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/upload-nightly-release.yml b/.github/workflows/upload-nightly-release.yml index 6f33c22ad37..7fd739205cc 100644 --- a/.github/workflows/upload-nightly-release.yml +++ b/.github/workflows/upload-nightly-release.yml @@ -2,8 +2,8 @@ name: Build nightly PennyLane releases for TestPyPI on: schedule: - # Run every weekday at 23:40 EDT (cron is in UTC) - - cron: "40 3 * * 2-6" + # Run every weekday at 5:50 EDT (cron is in UTC) + - cron: "50 9 * * 1-5" workflow_dispatch: jobs: @@ -38,7 +38,8 @@ jobs: steps: - name: Build wheels run: | - python setup.py bdist_wheel --dist-dir dist + python -m pip install build + python -m build --wheel --outdir dist - name: Upload wheels uses: pypa/gh-action-pypi-publish@release/v1