Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make upload versions unique for TestPyPI #2436

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions .github/workflows/publish-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install build
- name: change mitiq version
run: |
truncate -s -1 VERSION.txt
echo "$(date +"%Y%m%d")" >> VERSION.txt
- name: Build mitiq
run: python -m build
- name: Store build artifacts
Expand Down Expand Up @@ -50,27 +54,3 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

verify-version:
needs: test-publish
runs-on: ubuntu-latest
environment: testpypi
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install package from TestPyPI
run: pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.python.org/simple/ mitiq
- name: Set version variable
run: |
VER=$(cat VERSION.txt)
echo "VERSION=$VER" >> $GITHUB_ENV

- name: Verify the published version
run: |
TEST_IMPORT_VERSION=$(python -c "import mitiq; print(mitiq.__version__)")
if [ "$TEST_IMPORT_VERSION" != "$VERSION" ]; then
echo "Imported version $TEST_IMPORT_VERSION does not match tag $VERSION"
exit 1
fi