Update Wiki-Page with latest releases

This commit is contained in:
BtbN 2020-09-30 21:27:42 +02:00
parent 37c9a59840
commit cc070b4233
3 changed files with 45 additions and 3 deletions

View file

@ -134,14 +134,20 @@ jobs:
name: ffmpeg
path: artifacts
- name: Create release
id: create_release
run: |
set -xe
NAME="Auto-Build $(date +'%Y-%m-%d %H:%M')"
TAGNAME="autobuild-$(date +'%Y-%m-%d-%H-%M')"
hub release create $(for a in artifacts/*; do echo -a $a; done) -m "$NAME" -t "master" "$TAGNAME"
hub release create $(for a in artifacts/*.zip; do echo -a $a; done) -m "$NAME" -t "master" "$TAGNAME"
echo "::set-output name=tag_name::${TAGNAME}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
- name: Update Wiki
run: ./util/update_wiki.sh artifacts ${{ steps.create_release.outputs.tag_name }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Prune old releases
run: ./util/prunetags.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}

View file

@ -69,4 +69,5 @@ rm -rf ffbuild
if [[ -n "$GITHUB_ACTIONS" ]]; then
echo "::set-output name=build_name::${BUILD_NAME}"
echo "${BUILD_NAME}.zip" > "${ARTIFACTS_PATH}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}.txt"
fi

35
util/update_wiki.sh Executable file
View file

@ -0,0 +1,35 @@
#!/bin/bash
set -e
if [[ $# != 2 ]]; then
echo "Missing arguments"
exit -1
fi
if [[ -z "$GITHUB_REPOSITORY" || -z "$GITHUB_TOKEN" || -z "$GITHUB_ACTOR" ]]; then
echo "Missing environment"
exit -1
fi
INPUTS="$1"
TAGNAME="$2"
WIKIPATH="tmp_wiki"
WIKIFILE="Latest.md"
git clone "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.wiki.git" "${WIKIPATH}"
echo "# Latest Autobuilds" > "${WIKIPATH}/${WIKIFILE}"
for f in "${INPUTS}"/*.txt; do
VARIANT="${f::-4}"
echo "[${VARIANT}](https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAGNAME}/$(cat "${f}"))" >> "${WIKIPATH}/${WIKIFILE}"
done
cd "${WIKIPATH}"
git config user.email "actions@github.com"
git config user.name "Github Actions"
git add "$WIKIFILE"
git commit -m "Update latest version info"
git push
cd ..
rm -rf "$WIKIPATH"