|
9 | 9 | # "Decoder <version>"; basic keeps the tag and the title; |
10 | 10 | # - the notes hold one line per branch, "Decoder <v2 version> (...)" and |
11 | 11 | # "Legacy `basic` <version> (...)"; each build rewrites its own line; |
12 | | -# - SHA256SUMS is computed again over all the release's files. |
| 12 | +# - a SHA256SUMS left from earlier releases is removed (no checksums, #236). |
13 | 13 | # |
14 | 14 | # Writes new=true to $GITHUB_OUTPUT when the branch's version differs from |
15 | 15 | # the one the release had, so only a new version goes to Telegram. |
@@ -80,34 +80,24 @@ echo "previous $branch version: ${prev:-none}, now $ver" |
80 | 80 | { |
81 | 81 | [ -z "$v2line" ] || printf '%s\n' "$v2line" |
82 | 82 | [ -z "$basicline" ] || printf '%s\n' "$basicline" |
83 | | - printf '\nCheck: `sha256sum -c SHA256SUMS`. Changes: [CHANGELOG.md](%s/blob/v2/CHANGELOG.md); installation: [README](%s#readme).\n' "$url" "$url" |
| 83 | + printf '\nChanges: [CHANGELOG.md](%s/blob/v2/CHANGELOG.md); installation: [README](%s#readme).\n' "$url" "$url" |
84 | 84 | } > notes.md |
85 | 85 |
|
86 | | -# SHA256SUMS before anything changes: the other branch's files as the |
87 | | -# release has them now, plus this build's files; a v2 build without a |
88 | | -# mapping drops the previous one. |
89 | | -sums=$(mktemp -d) |
90 | | -if [ "$exists" = 1 ]; then |
91 | | - gh release download latest --dir "$sums" # every file the release holds |
92 | | -fi |
93 | | -rm -f "$sums/SHA256SUMS" |
94 | | -[ "$branch" = v2 ] && [ "$mapping" = 0 ] && rm -f "$sums/decoder-v2-mapping.txt" |
95 | | -cp "$@" "$sums/" |
96 | | -(cd "$sums" && find . -maxdepth 1 -type f -printf '%f\n' | LC_ALL=C sort | xargs sha256sum) > "$sums.sums" |
97 | | -mv "$sums.sums" "$sums/SHA256SUMS" |
98 | | -(cd "$sums" && sha256sum -c SHA256SUMS) |
99 | | - |
100 | 86 | if [ "$exists" = 0 ]; then |
101 | 87 | # a "latest" tag left without its release would keep its old commit under --target |
102 | 88 | if [ "$branch" = v2 ]; then |
103 | 89 | gh api -X PATCH "repos/${GITHUB_REPOSITORY}/git/refs/tags/latest" -f sha="$GITHUB_SHA" -F force=true \ |
104 | 90 | >/dev/null 2>&1 || true |
105 | 91 | fi |
106 | | - gh release create latest "$@" "$sums/SHA256SUMS" --latest --target "$GITHUB_SHA" \ |
| 92 | + gh release create latest "$@" --latest --target "$GITHUB_SHA" \ |
107 | 93 | --title "$title" --notes-file notes.md |
108 | 94 | else |
109 | | - # this build's files and the new SHA256SUMS in one upload |
110 | | - gh release upload latest "$@" "$sums/SHA256SUMS" --clobber |
| 95 | + gh release upload latest "$@" --clobber |
| 96 | + # a SHA256SUMS from before #236: removed if the release still has one; a failure stops here |
| 97 | + assets=$(gh release view latest --json assets -q '.assets[].name') # a lookup error stops here |
| 98 | + if printf '%s\n' "$assets" | grep -qx SHA256SUMS; then |
| 99 | + gh release delete-asset latest SHA256SUMS --yes |
| 100 | + fi |
111 | 101 | if [ "$branch" = v2 ] && [ "$mapping" = 0 ]; then |
112 | 102 | gh release delete-asset latest decoder-v2-mapping.txt --yes 2>/dev/null || true |
113 | 103 | fi |
|
116 | 106 | fi |
117 | 107 | gh release edit latest --title "$title" --notes-file notes.md --latest |
118 | 108 | fi |
119 | | -rm -rf "$sums" notes.md err.txt |
| 109 | +rm -f notes.md err.txt |
0 commit comments