From e43dcad30abeeb864e391725a19379e47d14c9a0 Mon Sep 17 00:00:00 2001 From: konstantinos Date: Mon, 13 Nov 2023 17:40:57 +0200 Subject: [PATCH] wip: test PyPI Job behaviour --- .github/workflows/test.yaml | 34 +++++++++++++++++++++++++--------- scripts/process_sem_ver.py | 1 - 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b9aebec..72e39bb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -154,6 +154,7 @@ jobs: matrix: ${{fromJSON(needs.set_github_outputs.outputs.matrix)}} outputs: SEMVER_PIP_FORMAT: ${{ steps.parse_version.outputs.SEMVER_PIP_FORMAT }} + ARTIFACTS: ${{ steps.set_artifacts_ref.outputs.ARTIFACTS }} steps: - run: echo "[INFO] Platform/OS ${{ matrix.platform }} , Python -> ${{ matrix.python-version }}" - uses: actions/checkout@v3 @@ -330,10 +331,13 @@ jobs: # if: ${{ matrix.platform == 'ubuntu-latest' || matrix.python-version != '3.6' }} # run: tox -e docs --sitepackages -vv -s false + - run: echo ARTIFACTS="${{ env.DIST_DIR }}-${{ matrix.platform }}-${{ matrix.python-version }}" >> $GITHUB_OUTPUT + id: set_artifacts_ref + - name: Upload Source & Wheel distributions as Artefacts uses: actions/upload-artifact@v3 with: - name: ${{ env.DIST_DIR }}-${{ matrix.platform }}-${{ matrix.python-version }} + name: ${{ steps.set_artifacts_ref.outputs.ARTIFACTS }} path: ${{ env.DIST_DIR }} if-no-files-found: error @@ -436,17 +440,29 @@ jobs: ### PYPI UPLOAD JOB ### pypi_publ: needs: [test_suite, check_which_git_branch_we_are_on] - if: startsWith(github.event.ref, 'refs/tags/v') && needs.check_which_git_branch_we_are_on.outputs.AUTOMATED_DEPLOY + name: PyPI - Creds from Repo Environment uses: boromir674/automated-workflows/.github/workflows/pypi_env.yml@test with: distro_name: "artificial_artwork" - distro_version: ${{ needs.test_suite.outputs.SEMVER_PIP_FORMAT }} - should_trigger: true - # does not affect the job, but is used to name the artifacts folder - artifacts_path: "downloaded-artifacts" - pypi_env: ${{ needs.check_which_git_branch_we_are_on.outputs.ENVIRONMENT_NAME }} - # optional - dist_folder: "dist" + distro_version: "${{ needs.test_suite.outputs.SEMVER_PIP_FORMAT }}" + should_trigger: ${{ startsWith(github.event.ref, 'refs/tags/v') && needs.check_which_git_branch_we_are_on.outputs.AUTOMATED_DEPLOY }} + pypi_env: "${{ needs.check_which_git_branch_we_are_on.outputs.ENVIRONMENT_NAME }}" + artifacts_path: ${{ needs.test_suite.outputs.ARTIFACTS }} + secrets: + # This magically works, and the environment secret will be loaded + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + + # if: startsWith(github.event.ref, 'refs/tags/v') && needs.check_which_git_branch_we_are_on.outputs.AUTOMATED_DEPLOY + # uses: boromir674/automated-workflows/.github/workflows/pypi_env.yml@test + # with: + # distro_name: "artificial_artwork" + # distro_version: ${{ needs.test_suite.outputs.SEMVER_PIP_FORMAT }} + # should_trigger: true + # # does not affect the job, but is used to name the artifacts folder + # artifacts_path: "downloaded-artifacts" + # pypi_env: ${{ needs.check_which_git_branch_we_are_on.outputs.ENVIRONMENT_NAME }} + # # optional + # dist_folder: "dist" ### PYPI UPLOAD JOB ### # pypi_publish: diff --git a/scripts/process_sem_ver.py b/scripts/process_sem_ver.py index 7b02f2a..dd7e3c4 100644 --- a/scripts/process_sem_ver.py +++ b/scripts/process_sem_ver.py @@ -186,7 +186,6 @@ # https://peps.python.org/pep-0440/#compatibility-with-other-version-schemes -# TODO use pep440 _regex (see top of cript) parsed_versions_string = _regex.match(semver) prerelease = parsed_versions_string.group("pre") or parsed_versions_string.group("dev") or ''