1
+ ---
1
2
name : Upload nightly wheels to Anaconda Cloud
2
3
3
4
on :
@@ -14,13 +15,10 @@ jobs:
14
15
upload_nightly_wheels :
15
16
name : Upload nightly wheels to Anaconda Cloud
16
17
runs-on : ubuntu-latest
17
- defaults :
18
- run :
19
- shell : bash -l {0}
20
18
if : github.repository_owner == 'matplotlib'
21
19
22
20
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
24
22
- name : Download wheel artifacts from last build on 'main'
25
23
env :
26
24
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -33,16 +31,20 @@ jobs:
33
31
gh run --repo "${PROJECT_REPO}" \
34
32
list --branch "${BRANCH}" \
35
33
--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
42
35
RUN_ID=$(
43
36
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
45
46
)
47
+ gh run --repo "${PROJECT_REPO}" view "${RUN_ID}"
46
48
gh run --repo "${PROJECT_REPO}" \
47
49
download "${RUN_ID}" --name "${ARTIFACT_NAME}"
48
50
@@ -71,17 +73,16 @@ jobs:
71
73
N_LATEST_UPLOADS=5
72
74
73
75
# 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 ' + '.
76
79
anaconda show scipy-wheels-nightly/matplotlib &> >(grep '+') | \
77
80
sed 's/.* + //' | \
78
81
head --lines "-${N_LATEST_UPLOADS}" > remove-package-versions.txt
79
82
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