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

Fix pypi CI #58

Merged
merged 8 commits into from
Mar 13, 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
55 changes: 48 additions & 7 deletions .github/workflows/pypi_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ concurrency:
cancel-in-progress: true

jobs:
pypi-publish:
testpypi-publish:
name: publish to Test PyPi
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/tags/vdev-latest' }}

strategy:
fail-fast: true
matrix:
Expand All @@ -21,13 +24,12 @@ jobs:
url: https://test.pypi.org/p/pomdp-py/
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write

steps:
- name: Set Variables
if: startsWith(github.ref, 'refs/tags/v')
run: | # Run the command within a multiline string
echo "VERSION=\"Version ${{ github.ref_name }}\"" >> $GITHUB_ENV
echo "TRIGGER_FOR_TEST_PYPI=${{ github.ref == 'refs/tags/vdev-latest' }}" >> $GITHUB_ENV
run: echo "VERSION=\"Version ${{ github.ref_name }}\"" >> $GITHUB_ENV

- uses: actions/setup-python@v5
with:
Expand All @@ -49,22 +51,61 @@ jobs:

- name: Upload to Test PyPi
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ env.TRIGGER_FOR_TEST_PYPI }}
with:
# This will upload stuff under dist/ to PyPI
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip-existing: true

- name: Release artifact
uses: softprops/action-gh-release@v1
with:
name: ${{ env.VERSION }}
files: dist/*.whl


pypi-publish:
name: publish to PyPi
runs-on: ubuntu-latest
if: ${{ github.ref != 'refs/tags/vdev-latest' }}
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
environment:
name: pypi
url: https://pypi.org/p/pomdp-py/
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write

steps:
- name: Set Variables
if: startsWith(github.ref, 'refs/tags/v')
run: echo "VERSION=\"Version ${{ github.ref_name }}\"" >> $GITHUB_ENV

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip

- name: Run release script
working-directory: .
run: |
cd scripts
./pomdp_py_release.sh ${{ vars.RELEASE_ATTEMPT_COUNT }}

- name: Upload to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ ! env.TRIGGER_FOR_TEST_PYPI }}
with:
# This will upload stuff under dist/ to PyPI
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
repository_url: https://pypi.org/
skip-existing: true

- name: Release artifact
Expand Down
Loading