Skip to content

Commit 7092a64

Browse files
yuvc21mikehardy
authored andcommitted
feat: implement draft workflow for immutable releases
- Create releases as drafts initially with --draft flag - Upload all assets to draft release - Publish release after all assets are uploaded - Ensures releases follow immutable release best practices See: https://cli.github.com/manual/gh_release_create (--draft flag) See: https://cli.github.com/manual/gh_release_edit (publishing draft) Fixes #19640
1 parent 1512be9 commit 7092a64

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

tools/release.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
187187
# Read the content of the markdown file using the absolute path
188188
RELEASE_NOTES="$SCRIPT_DIR/release-description.md"
189189
echo "Creating new Github release"
190-
gh release create v"$VERSION" --title "AnkiDroid $VERSION" -F "$RELEASE_NOTES" $RELEASE_TYPE
190+
gh release create v"$VERSION" --title "AnkiDroid $VERSION" -F "$RELEASE_NOTES" $RELEASE_TYPE --draft
191191

192192
echo "Sleeping 30s to make sure the release exists, see issue 11746"
193193
sleep 30
@@ -248,3 +248,12 @@ for BUILD in $BUILDNAMES; do
248248
cp AnkiDroid-"$VERSION".parallel."$BUILD".apk "$PREFIX"AnkiDroid-"$VERSION".parallel."$BUILD".apk
249249
gh release upload v"$VERSION" "$PREFIX"AnkiDroid-"$VERSION".parallel."$BUILD".apk
250250
done
251+
252+
# For publishing the draft release and making it immutable;
253+
echo "Publishing release (making it immutable)"
254+
if ! gh release edit v"$VERSION" --draft=false;
255+
then
256+
echo "Failed to publish release"
257+
exit 1
258+
fi
259+
echo "Release published successfully"

0 commit comments

Comments
 (0)