|
22 | 22 | type: string |
23 | 23 | required: true |
24 | 24 |
|
| 25 | +concurrency: ${{ inputs.artifact_folder || format('{0}-{1}', github.event.workflow_run.id, github.event.workflow_run.run_attempt) }} |
| 26 | + |
25 | 27 | jobs: |
26 | 28 | prepare: |
27 | 29 | name: Prepare and guard upload |
|
33 | 35 | - name: Determine S3 Prefix |
34 | 36 | id: get_s3_prefix |
35 | 37 | 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) }}" |
41 | 39 | if [[ -n "${artifact_folder}" ]]; then |
42 | 40 | s3_prefix="${{ github.repository }}/${artifact_folder}" |
43 | 41 | echo "Created S3 prefix: ${s3_prefix}" |
@@ -74,11 +72,18 @@ jobs: |
74 | 72 | runs-on: ubuntu-latest |
75 | 73 | environment: |
76 | 74 | name: ${{ github.event_name == 'workflow_dispatch' && inputs.environment || 'test.pypi' }} |
77 | | - #if: ${{ vars.PYPI_URL != '' }} |
78 | 75 | permissions: |
79 | 76 | # this is needed for the OIDC flow that is used with trusted publishing on PyPI |
80 | 77 | id-token: write |
81 | 78 | 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 | +
|
82 | 87 | - name: Authenticate With AWS |
83 | 88 | uses: aws-actions/configure-aws-credentials@v4 |
84 | 89 | with: |
|
96 | 101 | aws s3 cp --recursive "${S3_URL}" packages |
97 | 102 |
|
98 | 103 | - name: Upload artifacts to PyPI |
99 | | - if: ${{ vars.PYPI_URL != '' }} |
100 | 104 | uses: pypa/gh-action-pypi-publish@release/v1 |
101 | 105 | with: |
102 | 106 | repository-url: ${{ vars.PYPI_URL }} |
|
0 commit comments