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

correctly set and pass mitiq VERSION env var #2428

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 9 additions & 7 deletions .github/workflows/publish-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
name: Build Mitiq
if: github.repository_owner == 'unitaryfund'
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.export-version.outputs.VERSION }}
steps:
- name: Check out mitiq
uses: actions/checkout@v4
Expand All @@ -23,6 +25,9 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install build
- name: Export version variable
id: export-version
run: echo "VERSION=$(cat VERSION.txt)" >> "$GITHUB_OUTPUT"
- name: Build mitiq
run: python -m build
- name: Store build artifacts
Expand Down Expand Up @@ -52,22 +57,19 @@ jobs:
repository-url: https://test.pypi.org/legacy/

verify-version:
needs: test-publish
needs: [build, test-publish]
runs-on: ubuntu-latest
environment: testpypi
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- 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
env:
VERSION: ${{ needs.build.outputs.VERSION }}
run: |
TEST_IMPORT_VERSION=$(python -c "import mitiq; print(mitiq.__version__)")
if [ "$TEST_IMPORT_VERSION" != "$VERSION" ]; then
Expand Down