Skip to content

Commit

Permalink
Include VERSIONS.md in commit message, tag, and release description
Browse files Browse the repository at this point in the history
Resize it to fit the commit message width limit and modify it to include
the current commit hashes for OpenSlide, OpenSlide Java, and
openslide-winbuild.

Signed-off-by: Benjamin Gilbert <[email protected]>
  • Loading branch information
bgilbert committed Sep 25, 2023
1 parent 1cafc1d commit 64f9175
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions .github/workflows/winbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,46 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
artifact="${{ needs.build.outputs.artifact }}"
pkgver="${{ needs.setup.outputs.pkgver }}"
title="Windows build $pkgver"
body="OpenSlide: openslide/openslide@$(echo ${{ needs.setup.outputs.openslide_commit }} | cut -c-8)
OpenSlide Java: openslide/openslide-java@$(echo ${{ needs.setup.outputs.java_commit }} | cut -c-8)
openslide-winbuild: openslide/openslide-winbuild@$(echo ${{ needs.setup.outputs.winbuild_commit }} | cut -c-8)"
unzip -j "${artifact}/openslide-win32-${pkgver}.zip" \
"openslide-win32-${pkgver}/VERSIONS.md"
# trim width for commit message limit
sed -i -e 's/ |$/|/' VERSIONS.md
pkglen=$(awk -F'|' '{print length($2) - 2; exit}' VERSIONS.md)
verlen=$(awk -F'|' '{print length($3) - 2; exit}' VERSIONS.md)
line() {
# args: friendly-name repo-name commit-hash emphasis
printf "| %-${pkglen}s | %-${verlen}s |" \
"$4$1$4" "${4}openslide/${2}@${3:0:8}${4}"
}
update_line() {
# args: friendly-name repo-name commit-hash emphasis
local new="$(line "$@")"
local escaped="$(sed 's/*/\\*/g' <<<"$4$1$4")"
sed -i -e "/$escaped/ s^.*^$new^" VERSIONS.md
}
update_line OpenSlide openslide \
"${{ needs.setup.outputs.openslide_commit }}" "**"
update_line "OpenSlide Java" openslide-java \
"${{ needs.setup.outputs.java_commit }}" "**"
line openslide-winbuild openslide-winbuild \
"${{ needs.setup.outputs.winbuild_commit }}" _ >> VERSIONS.md
title="Windows build $pkgver"
body="$(cat VERSIONS.md)"
git add docs
git commit -m "$title" -m "$body"
git tag -a "windows-$pkgver" -m "$title" -m "$body"
git push origin HEAD "windows-$pkgver"
gh release create --notes-file - --prerelease --verify-tag \
--title "Windows build $pkgver" "windows-$pkgver" \
"${{ needs.build.outputs.artifact }}/"* <<EOF
$body
"${artifact}/"* <<EOF
See the [build index](https://openslide.org/builds/windows/) for more info.
$body
EOF
keepalive:
Expand Down

0 comments on commit 64f9175

Please sign in to comment.