Incremental package builds and releases on v* tags (0.8.0)
build / build (push) Successful in 30m42s
build / build (push) Successful in 30m42s
- build-packages.sh rebuilds a package only when its srcpkgs/ directory changed, its binary package is missing, or a dry-run install finds a shared library Void no longer provides; DASOS_REBUILD=1 rebuilds all. An unchanged `make packages` takes 20 s instead of 17 min on the CI host - ci/release.sh publishes both ISOs and SHA256SUMS as a Gitea release when the workflow runs for a v* tag matching VERSION - README and TODO updated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# Publishes the ISO images of the current version as a Gitea release:
|
||||
# release.sh <tag> <iso dir>
|
||||
# Needs GITEA_TOKEN, GITEA_SERVER_URL and GITEA_REPOSITORY (owner/name); in CI
|
||||
# the job provides them. Running it again for the same tag replaces the files.
|
||||
set -eu
|
||||
|
||||
tag=$1
|
||||
dir=$2
|
||||
version=$(cat VERSION)
|
||||
[ "$tag" = "v$version" ] || { echo "release: tag $tag does not match VERSION $version" >&2; exit 1; }
|
||||
|
||||
api=$GITEA_SERVER_URL/api/v1/repos/$GITEA_REPOSITORY
|
||||
auth="Authorization: token $GITEA_TOKEN"
|
||||
json() { python3 -c "import json,sys; d=json.load(sys.stdin); $1"; }
|
||||
|
||||
isos="dasos-$version-x86_64.iso dasos-server-$version-x86_64.iso"
|
||||
cd "$dir"
|
||||
sha256sum $isos >SHA256SUMS
|
||||
|
||||
if ! id=$(curl -fsS -H "$auth" "$api/releases/tags/$tag" 2>/dev/null | json 'print(d["id"])' 2>/dev/null); then
|
||||
id=$(curl -fsS -H "$auth" -H 'Content-Type: application/json' \
|
||||
-d "{\"tag_name\":\"$tag\",\"name\":\"Das OS $version\",\"body\":\"Desktop and server live ISO images. Check them with sha256sum -c SHA256SUMS.\"}" \
|
||||
"$api/releases" | json 'print(d["id"])')
|
||||
echo "release: created $tag (id $id)"
|
||||
fi
|
||||
|
||||
# Files left from an earlier run for this tag are replaced
|
||||
curl -fsS -H "$auth" "$api/releases/$id/assets" |
|
||||
json '[print(a["id"], a["name"]) for a in d]' |
|
||||
while read -r asset name; do
|
||||
case " $isos SHA256SUMS " in
|
||||
*" $name "*) curl -fsS -X DELETE -H "$auth" "$api/releases/$id/assets/$asset" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
for f in $isos SHA256SUMS; do
|
||||
echo "release: uploading $f"
|
||||
curl -fsS -o /dev/null -H "$auth" -F "attachment=@$f" "$api/releases/$id/assets?name=$f"
|
||||
done
|
||||
echo "release: $GITEA_SERVER_URL/$GITEA_REPOSITORY/releases/tag/$tag"
|
||||
Reference in New Issue
Block a user