1+ ---
12name : Upload nightly wheels to Anaconda Cloud
23
34on :
@@ -14,13 +15,10 @@ jobs:
1415 upload_nightly_wheels :
1516 name : Upload nightly wheels to Anaconda Cloud
1617 runs-on : ubuntu-latest
17- defaults :
18- run :
19- shell : bash -l {0}
2018 if : github.repository_owner == 'matplotlib'
2119
2220 steps :
23- # c.f. https://github.com/actions/download-artifact/issues/3#issuecomment-1017141067
21+ # https://github.com/actions/download-artifact/issues/3#issuecomment-1017141067
2422 - name : Download wheel artifacts from last build on 'main'
2523 env :
2624 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -33,16 +31,20 @@ jobs:
3331 gh run --repo "${PROJECT_REPO}" \
3432 list --branch "${BRANCH}" \
3533 --workflow "${WORKFLOW_NAME}" \
36- --json event,status,databaseId > runs.json
37- # Filter on 'push' events to main (merged PRs) that have completed
38- jq --compact-output \
39- '[ .[] | select(.event == "push") | select(.status == "completed") ]' \
40- runs.json > pushes.json
41- # Get id of latest build of wheels
34+ --json event,status,conclusion,databaseId > runs.json
4235 RUN_ID=$(
4336 jq --compact-output \
44- 'sort_by(.databaseId) | reverse | .[0].databaseId' pushes.json
37+ '[
38+ .[] |
39+ # Filter on "push" events to main (merged PRs) ...
40+ select(.event == "push") |
41+ # that have completed successfully ...
42+ select(.status == "completed" and .conclusion == "success")
43+ ] |
44+ # and get ID of latest build of wheels.
45+ sort_by(.databaseId) | reverse | .[0].databaseId' runs.json
4546 )
47+ gh run --repo "${PROJECT_REPO}" view "${RUN_ID}"
4648 gh run --repo "${PROJECT_REPO}" \
4749 download "${RUN_ID}" --name "${ARTIFACT_NAME}"
4850
@@ -71,17 +73,16 @@ jobs:
7173 N_LATEST_UPLOADS=5
7274
7375 # Remove all _but_ the last "${N_LATEST_UPLOADS}" package versions
74- # N.B.: `anaconda show` places the newest packages at the bottom of the output
75- # of the 'Versions' section and package versions are preceded with a ' + '.
76+ # N.B.: `anaconda show` places the newest packages at the bottom of
77+ # the output of the 'Versions' section and package versions are
78+ # preceded with a ' + '.
7679 anaconda show scipy-wheels-nightly/matplotlib &> >(grep '+') | \
7780 sed 's/.* + //' | \
7881 head --lines "-${N_LATEST_UPLOADS}" > remove-package-versions.txt
7982
80- if [ -s remove-package-versions.txt ]; then
81- while LANG=C IFS= read -r package_version ; do
82- echo "# Removing scipy-wheels-nightly/matplotlib/${package_version}"
83- anaconda --token ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} remove \
84- --force \
85- "scipy-wheels-nightly/matplotlib/${package_version}"
86- done <remove-package-versions.txt
87- fi
83+ while LANG=C IFS= read -r package_version ; do
84+ echo "Removing scipy-wheels-nightly/matplotlib/${package_version}"
85+ anaconda --token ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} remove \
86+ --force \
87+ "scipy-wheels-nightly/matplotlib/${package_version}"
88+ done <remove-package-versions.txt
0 commit comments