Skip to content

Commit 0063906

Browse files
authored
automate github release with changelog (#626)
* automate github release with changelog * apply PR feedback, add makefile, move scripts to _tooling * fix docs index
1 parent fc252b5 commit 0063906

File tree

15 files changed

+81
-16
lines changed

15 files changed

+81
-16
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ jobs:
417417
"$SLACK_HOOK"
418418
419419
420-
pypi:
420+
pypi_and_gh_release:
421421
needs: [cluster_tools, webknossos_linux, wkcuber_linux, wkcuber_win, wkcuber_mac]
422422
if: |
423423
always() &&
@@ -443,10 +443,25 @@ jobs:
443443
env:
444444
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
445445
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
446-
run: ./publish.sh
446+
run: _tooling/publish.sh
447+
- name: Prepare github release
448+
run: |
449+
VERSION="$(dunamai from git)"
450+
_tooling/changelog_for_version.sh $VERSION > Changelog.md
451+
- name: Publish github release
452+
id: create_release
453+
uses: actions/create-release@v1
454+
env:
455+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
456+
with:
457+
tag_name: ${{ github.ref }}
458+
release_name: ${{ github.ref }}
459+
body_path: Changelog.md
460+
draft: false
461+
prerelease: false
447462

448463
complete:
449-
needs: [cluster_tools, webknossos_linux, wkcuber_linux, wkcuber_win, wkcuber_mac, wkcuber_docker, docs, pypi]
464+
needs: [cluster_tools, webknossos_linux, wkcuber_linux, wkcuber_win, wkcuber_mac, wkcuber_docker, docs, pypi_and_gh_release]
450465
if: always()
451466
runs-on: ubuntu-latest
452467
steps:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
3838
- name: Make and push release
3939
run: |
40-
./make_release.sh ${VERSION}
40+
_tooling/make_release.sh ${VERSION}
4141
git add */Changelog.md
4242
4343
git commit -m "Release for v${VERSION}"

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
packages_by_priority := webknossos wkcuber cluster_tools docs
2+
packages_by_dependency := cluster_tools webknossos wkcuber docs
3+
4+
define in_each_pkg_by_dependency
5+
for PKG in $(packages_by_dependency); do echo $$PKG; cd $$PKG; $1; cd ..; done
6+
endef
7+
8+
.PHONY: list_packages_by_priority update update-internal install
9+
10+
list_packages_by_priority:
11+
@echo $(packages_by_priority)
12+
13+
update:
14+
$(call in_each_pkg_by_dependency, poetry update --no-dev)
15+
16+
update-internal:
17+
$(call in_each_pkg_by_dependency, poetry update $(packages_by_dependency))
18+
19+
install:
20+
$(call in_each_pkg_by_dependency, poetry install)
File renamed without changes.

_tooling/changelog_for_version.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
set -eEuo pipefail
3+
set +x
4+
5+
if [ $# -eq 0 ]; then
6+
VERSION_START="^## Unreleased"
7+
else
8+
VERSION_START="^## \[$1\]"
9+
fi
10+
VERSION_END="^## \["
11+
12+
for PKG in $(make list_packages_by_priority); do
13+
if [ ! -f "$PKG/Changelog.md" ]; then
14+
continue
15+
fi
16+
17+
CHANGES="$(awk "/$VERSION_START/{flag=1;next} /$VERSION_END/{flag=0} flag" "$PKG/Changelog.md" | tail -n +2)"
18+
19+
WORDS_IN_CHANGES="$(echo "${CHANGES%x}" | grep --invert-match "###" | wc -w)"
20+
21+
if [ "$WORDS_IN_CHANGES" != "0" ]; then
22+
echo "## $PKG"
23+
echo "${CHANGES%x}"
24+
echo
25+
echo
26+
fi
27+
done
File renamed without changes.

make_release.sh renamed to _tooling/make_release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fi
99

1010
PKG_VERSION="$1"
1111

12-
if ! python check_version.py ${PKG_VERSION}; then
12+
if ! python _tooling/check_version.py ${PKG_VERSION}; then
1313
echo "A higher version is already present."
1414
exit 1
1515
fi
@@ -24,7 +24,7 @@ for PKG in */pyproject.toml; do
2424

2525
pushd "$PKG" > /dev/null
2626

27-
python ../make_changelog.py "$PKG_VERSION"
27+
python ../_tooling/changelog_bump_version.py "$PKG_VERSION"
2828

2929
popd > /dev/null
3030
done
File renamed without changes.

cluster_tools/pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[tool.poetry]
22
name = "cluster_tools"
3-
version = "0.0.0"
3+
version = "0.0.0" # filled by dunamai
44
description = "Utility library for easily distributing code execution on clusters"
55
authors = ["scalable minds <[email protected]>"]
6+
readme = "README.md"
67
license = "MIT"
8+
repository = "https://github.com/scalableminds/webknossos-libs"
79

810
[tool.poetry.dependencies]
911
python = "^3.6.2"
@@ -22,4 +24,4 @@ requires = ["poetry-core>=1.0.0"]
2224
build-backend = "poetry.core.masonry.api"
2325

2426
[tool.isort]
25-
profile = "black"
27+
profile = "black"

docs/mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ nav:
6060
- Frontend Scripting API: https://webknossos.org/assets/docs/frontend-api/index.html" target="_blank
6161
- Changelog: webknossos/CHANGELOG.released.md
6262
- Migration Guide: webknossos/MIGRATIONS.released.md
63-
- [GitHub](https://github.com/scalableminds/webknossos)
63+
- GitHub: https://github.com/scalableminds/webknossos" target="_blank
6464
- Getting Help:
6565
- webknossos/faq.md
6666
- Community Support: https://forum.image.sc/tag/webknossos" target="_blank

0 commit comments

Comments
 (0)