Skip to content

Commit 99fe330

Browse files
committed
Small pypi upload fixes
1 parent e97180c commit 99fe330

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

.github/workflows/upload_to_pypi.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ on:
2222
type: string
2323
required: true
2424

25+
concurrency: ${{ inputs.artifact_folder || format('{0}-{1}', github.event.workflow_run.id, github.event.workflow_run.run_attempt) }}
26+
2527
jobs:
2628
prepare:
2729
name: Prepare and guard upload
@@ -33,11 +35,7 @@ jobs:
3335
- name: Determine S3 Prefix
3436
id: get_s3_prefix
3537
run: |
36-
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
37-
artifact_folder="${{ inputs.artifact_folder }}"
38-
elif [[ -n "${{ github.event.workflow_run.id }}" && -n "${{ github.event.workflow_run.run_attempt }}" ]]; then
39-
artifact_folder="${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}"
40-
fi
38+
artifact_folder="${{ inputs.artifact_folder || format('{0}-{1}', github.event.workflow_run.id, github.event.workflow_run.run_attempt) }}"
4139
if [[ -n "${artifact_folder}" ]]; then
4240
s3_prefix="${{ github.repository }}/${artifact_folder}"
4341
echo "Created S3 prefix: ${s3_prefix}"
@@ -74,11 +72,18 @@ jobs:
7472
runs-on: ubuntu-latest
7573
environment:
7674
name: ${{ github.event_name == 'workflow_dispatch' && inputs.environment || 'test.pypi' }}
77-
#if: ${{ vars.PYPI_URL != '' }}
7875
permissions:
7976
# this is needed for the OIDC flow that is used with trusted publishing on PyPI
8077
id-token: write
8178
steps:
79+
- name: Fail if PYPI_URL is not set
80+
if: ${{ vars.PYPI_URL == '' }}
81+
shell: bash
82+
run: |
83+
env_name="${{ github.event_name == 'workflow_dispatch' && inputs.environment || 'test.pypi' }}"
84+
echo "Error: vars.PYPI_URL is not set in the resolved environment (${env_name})"
85+
exit 1
86+
8287
- name: Authenticate With AWS
8388
uses: aws-actions/configure-aws-credentials@v4
8489
with:
@@ -96,7 +101,6 @@ jobs:
96101
aws s3 cp --recursive "${S3_URL}" packages
97102
98103
- name: Upload artifacts to PyPI
99-
if: ${{ vars.PYPI_URL != '' }}
100104
uses: pypa/gh-action-pypi-publish@release/v1
101105
with:
102106
repository-url: ${{ vars.PYPI_URL }}

0 commit comments

Comments
 (0)