From 1c88f610e370ad6de709965abf9792c5a3c01b0c Mon Sep 17 00:00:00 2001 From: Kaiyu Zheng Date: Tue, 12 Mar 2024 20:01:18 -0400 Subject: [PATCH 1/8] separate testpypi and pypi jobs --- .github/workflows/pypi_deployment.yml | 51 +++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pypi_deployment.yml b/.github/workflows/pypi_deployment.yml index a074385..3defd7a 100644 --- a/.github/workflows/pypi_deployment.yml +++ b/.github/workflows/pypi_deployment.yml @@ -10,8 +10,11 @@ concurrency: cancel-in-progress: true jobs: - pypi-publish: + testpypi-publish: + name: Build & publish pomdp-py to Test PyPi runs-on: ubuntu-latest + if: {{ github.ref == 'refs/tags/vdev-latest' }} + strategy: fail-fast: true matrix: @@ -25,9 +28,7 @@ jobs: 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: @@ -49,7 +50,6 @@ 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__ @@ -57,9 +57,48 @@ jobs: 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: Build & publish pomdp-py 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 + + 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__ From 6fc47e963b218f4ae8eef64d735af0d0f9c96bdd Mon Sep 17 00:00:00 2001 From: Kaiyu Zheng Date: Tue, 12 Mar 2024 20:03:50 -0400 Subject: [PATCH 2/8] syntax --- .github/workflows/pypi_deployment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi_deployment.yml b/.github/workflows/pypi_deployment.yml index 3defd7a..d6e0eb7 100644 --- a/.github/workflows/pypi_deployment.yml +++ b/.github/workflows/pypi_deployment.yml @@ -13,7 +13,7 @@ jobs: testpypi-publish: name: Build & publish pomdp-py to Test PyPi runs-on: ubuntu-latest - if: {{ github.ref == 'refs/tags/vdev-latest' }} + if: ${{ github.ref == 'refs/tags/vdev-latest' }} strategy: fail-fast: true @@ -67,7 +67,7 @@ jobs: pypi-publish: name: Build & publish pomdp-py to PyPi runs-on: ubuntu-latest - if: {{ github.ref != 'refs/tags/vdev-latest' }} + if: ${{ github.ref != 'refs/tags/vdev-latest' }} strategy: fail-fast: true matrix: From c8dfa58f08c7c66cd2c673716c919d1a347e4eac Mon Sep 17 00:00:00 2001 From: Kaiyu Zheng Date: Tue, 12 Mar 2024 20:05:31 -0400 Subject: [PATCH 3/8] shorter job name --- .github/workflows/pypi_deployment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi_deployment.yml b/.github/workflows/pypi_deployment.yml index d6e0eb7..01acc67 100644 --- a/.github/workflows/pypi_deployment.yml +++ b/.github/workflows/pypi_deployment.yml @@ -11,7 +11,7 @@ concurrency: jobs: testpypi-publish: - name: Build & publish pomdp-py to Test PyPi + name: publish to Test PyPi runs-on: ubuntu-latest if: ${{ github.ref == 'refs/tags/vdev-latest' }} @@ -65,7 +65,7 @@ jobs: pypi-publish: - name: Build & publish pomdp-py to PyPi + name: publish to PyPi runs-on: ubuntu-latest if: ${{ github.ref != 'refs/tags/vdev-latest' }} strategy: From e3ec26a3ec9ace7ebd5eb8742418059d755d8b02 Mon Sep 17 00:00:00 2001 From: Kaiyu Zheng Date: Tue, 12 Mar 2024 20:15:11 -0400 Subject: [PATCH 4/8] allow release ?? --- .github/workflows/pypi_deployment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pypi_deployment.yml b/.github/workflows/pypi_deployment.yml index 01acc67..0093220 100644 --- a/.github/workflows/pypi_deployment.yml +++ b/.github/workflows/pypi_deployment.yml @@ -24,6 +24,7 @@ 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 From 048056a3a14b3caca5536f3829940b6b20548b6c Mon Sep 17 00:00:00 2001 From: Kaiyu Zheng Date: Tue, 12 Mar 2024 20:16:02 -0400 Subject: [PATCH 5/8] ggg --- .github/workflows/pypi_deployment.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi_deployment.yml b/.github/workflows/pypi_deployment.yml index 0093220..e77085a 100644 --- a/.github/workflows/pypi_deployment.yml +++ b/.github/workflows/pypi_deployment.yml @@ -46,8 +46,10 @@ jobs: - name: Run release script working-directory: . run: | - cd scripts - ./pomdp_py_release.sh ${{ vars.RELEASE_ATTEMPT_COUNT }} + # cd scripts + # ./pomdp_py_release.sh ${{ vars.RELEASE_ATTEMPT_COUNT }} + mkdir dist + touch dist/dummy.txt - name: Upload to Test PyPi uses: pypa/gh-action-pypi-publish@release/v1 From 96f0c05d172c1acaca097ecf8ac37e0795e0b8af Mon Sep 17 00:00:00 2001 From: Kaiyu Zheng Date: Tue, 12 Mar 2024 20:17:25 -0400 Subject: [PATCH 6/8] quick test --- .github/workflows/pypi_deployment.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pypi_deployment.yml b/.github/workflows/pypi_deployment.yml index e77085a..09b176b 100644 --- a/.github/workflows/pypi_deployment.yml +++ b/.github/workflows/pypi_deployment.yml @@ -51,14 +51,14 @@ jobs: mkdir dist touch dist/dummy.txt - - name: Upload to Test PyPi - uses: pypa/gh-action-pypi-publish@release/v1 - 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: Upload to Test PyPi + # uses: pypa/gh-action-pypi-publish@release/v1 + # 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 From 370ae23d4f415ec65b0e45da688cbfe6c79a7470 Mon Sep 17 00:00:00 2001 From: Kaiyu Zheng Date: Tue, 12 Mar 2024 20:18:07 -0400 Subject: [PATCH 7/8] verified and revert --- .github/workflows/pypi_deployment.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pypi_deployment.yml b/.github/workflows/pypi_deployment.yml index 09b176b..0093220 100644 --- a/.github/workflows/pypi_deployment.yml +++ b/.github/workflows/pypi_deployment.yml @@ -46,19 +46,17 @@ jobs: - name: Run release script working-directory: . run: | - # cd scripts - # ./pomdp_py_release.sh ${{ vars.RELEASE_ATTEMPT_COUNT }} - mkdir dist - touch dist/dummy.txt - - # - name: Upload to Test PyPi - # uses: pypa/gh-action-pypi-publish@release/v1 - # 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 + cd scripts + ./pomdp_py_release.sh ${{ vars.RELEASE_ATTEMPT_COUNT }} + + - name: Upload to Test PyPi + uses: pypa/gh-action-pypi-publish@release/v1 + 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 From 3451d47ed8cc81b23af1418431e3553287c3d8db Mon Sep 17 00:00:00 2001 From: Kaiyu Zheng Date: Tue, 12 Mar 2024 20:26:53 -0400 Subject: [PATCH 8/8] fixes for pypi --- .github/workflows/pypi_deployment.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi_deployment.yml b/.github/workflows/pypi_deployment.yml index 0093220..5ce143d 100644 --- a/.github/workflows/pypi_deployment.yml +++ b/.github/workflows/pypi_deployment.yml @@ -78,6 +78,7 @@ jobs: 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 @@ -104,7 +105,7 @@ jobs: # 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