Skip to content

Commit

Permalink
Merge pull request #84 from Ericgig/hotfix
Browse files Browse the repository at this point in the history
Push improved action to the release branch
  • Loading branch information
Ericgig authored Jan 31, 2025
2 parents f0d5634 + d7679f7 commit d1aa332
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,43 @@ on:
- master
tags:
- v*
workflow_dispatch:


jobs:
update_version:
name: Update dev version
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Increment VERSION
run: |
version="$(cat VERSION)"; python -c "b, n = '$version'.split('v'); print('v'.join([b, str(int(n)+1)]))" > VERSION
- name: Add commit
run: |
git config --global user.email "Version_Incrementer@gh_bot"
git config --global user.name "Version Incrementer"
git commit -a -m "Increment version"
git push
- name: Check status
run: |
cat VERSION
build:
name: Build qutip-jax
if: ${{ always() }}
needs: update_version

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Checkout updated version
run: git pull
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down Expand Up @@ -54,11 +81,15 @@ jobs:
- name: Verify this is not a dev version
shell: bash
run: |
if [[ dist/*dev*.whl ]]; then exit 1; fi
if [[ "$GITHUB_REF" == *"master"* ]]; then exit 1; fi
ls dist/*dev*.whl
echo $GITHUB_REF
if [[ dist/*dev*.whl ]]; then echo dist/*dev*.whl; exit 1; fi
if [[ "$GITHUB_REF" == *"master"* ]]; then echo $GITHUB_REF; exit 1; fi
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true

github-release:
name: >-
Expand Down Expand Up @@ -117,3 +148,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
6 changes: 3 additions & 3 deletions .github/workflows/build_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
Expand All @@ -37,7 +37,7 @@ jobs:
make html SPHINXOPTS="-W --keep-going -T"
- name: Upload built files
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: qutip-jax_html_docs
path: doc/_build/html/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
case-name: [defaults]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: conda-incubator/setup-miniconda@v2
with:
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def _determine_version(options):
version = packaging.version.parse(version_string)
options['short_version'] = str(version.public)
options['release'] = not version.is_devrelease
if not options['release']:
diff = subprocess.run(["git", "diff", "master"], capture_output=True)
if not options['release'] and len(diff.stdout) != 0:
# Put the version string into canonical form, if it wasn't already.
version_string = str(version)
version_string += "+"
Expand Down

0 comments on commit d1aa332

Please sign in to comment.