Maintain floating "latest"-Release

This commit is contained in:
BtbN 2021-12-24 16:49:28 +01:00
parent b773ed8d71
commit 490e081b18
2 changed files with 60 additions and 1 deletions

View file

@ -163,10 +163,25 @@ jobs:
id: create_release id: create_release
run: | run: |
set -xe set -xe
NAME="Auto-Build $(date +'%Y-%m-%d %H:%M')" RELDATE="$(date +'%Y-%m-%d %H:%M')"
NAME="Auto-Build $RELDATE"
TAGNAME="autobuild-$(date +'%Y-%m-%d-%H-%M')" TAGNAME="autobuild-$(date +'%Y-%m-%d-%H-%M')"
hub release create $(for a in artifacts/*.{zip,tar.xz}; do echo -a $a; done) -m "$NAME" -t "master" "$TAGNAME" hub release create $(for a in artifacts/*.{zip,tar.xz}; do echo -a $a; done) -m "$NAME" -t "master" "$TAGNAME"
echo "::set-output name=tag_name::${TAGNAME}" echo "::set-output name=tag_name::${TAGNAME}"
echo "::set-output name=rel_date::${RELDATE}"
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Update Latest
run: |
set -xe
mkdir latest_artifacts
./util/repack_latest.sh latest_artifacts artifacts/*.{zip,tar.xz}
NAME="Latest Auto-Build (${{ steps.create_release.outputs.rel_date }})"
TAGNAME="latest"
hub release delete "$TAGNAME" || true
git tag -d "$TAGNAME" || true
git push --delete origin "$TAGNAME" || true
hub release create $(for a in latest_artifacts/*; do echo -a $a; done) -m "$NAME" -t "master" "$TAGNAME"
env: env:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
- name: Update Wiki - name: Update Wiki

44
util/repack_latest.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/bash
set -e
if [[ $# -lt 2 ]]; then
echo "Missing arguments"
exit -1
fi
RELEASE_DIR="$(realpath "$1")"
shift
rm -rf repack_dir
mkdir repack_dir
trap "rm -rf repack_dir" EXIT
while [[ $# -gt 0 ]]; do
INPUT="$1"
shift
rm -rf repack_dir/*
if [[ $INPUT == *.zip ]]; then
unzip "$INPUT" -d repack_dir
elif [[ $INPUT == *.tar.xz ]]; then
tar xvaf "$INPUT" -C repack_dir
else
echo "Unknown input file type: $INPUT"
exit 1
fi
cd repack_dir
INAME="$(echo ffmpeg-*)"
ONAME="ffmpeg-latest-$(cut -d- -f5- <<<"$INAME")"
mv "$INAME" "$ONAME"
if [[ $INPUT == *.zip ]]; then
zip -9 -r "$RELEASE_DIR/$ONAME.zip" "$ONAME"
elif [[ $INPUT == *.tar.xz ]]; then
tar cvJf "$RELEASE_DIR/$ONAME.tar.xz" "$ONAME"
fi
cd ..
done