Announce build_meta.json and simplify scripts

This commit is contained in:
FriwiDev 2021-11-16 00:31:16 +01:00
parent 018080b2ed
commit 3e63d617ab
3 changed files with 117 additions and 4 deletions

8
.gitignore vendored
View File

@ -1,6 +1,6 @@
out out
tools/*.txt release_gen/*.txt
tools/*.md release_gen/*.md
tools/*.json release_gen/*.json
tools/LICENSE release_gen/LICENSE

View File

@ -0,0 +1,17 @@
#!/bin/bash
if [ ! $# -eq 1 ]
then
echo "Usage: ./announce_build_meta.sh <releaserepo>"
echo ""
echo "releaserepo: Release repository on github - e.g. jcefmaven/jcefmaven"
exit 1
fi
#Announce build_meta.json to other jobs
(
echo "build_meta=https://github.com/$1/releases/download/"
cat release_tag.txt
echo "/build_meta.json"
) | awk '{print}' ORS='' >> $GITHUB_ENV
echo "" >> $GITHUB_ENV

View File

@ -0,0 +1,96 @@
#!/bin/bash
if [ ! $# -eq 5 ]
then
echo "Usage: ./create_release_info.sh <gitrepo> <gitref> <actionsurl> <actionsrunnumber> <releaserepo>"
echo ""
echo "gitrepo: git repository url to clone"
echo "gitref: the git commit id to pull"
echo "actionsurl: the url pointing to the builder job"
echo "actionsrunnumber: the number of the current build"
echo "releaserepo: Release repository on github - e.g. jcefmaven/jcefmaven"
exit 1
fi
#Remove text files from last run
rm -f *.txt
#Pull from git
git clone $1 jcef
cd jcef
git checkout $2
#Dump git commit id and suspected url
commit_id=$(git rev-parse HEAD | cut -c -7) #Use short 7-digit commit id
commit_id_long=$(git rev-parse HEAD)
commit_url=$(
(
sed 's/\.git.*$//' <<< "$1" #Remove .git and everything behind from url
echo "/commits/$commit_id_long" #Add long commit id
) | awk '{print}' ORS='' #Remove newlines
)
#Dump git commit message
commit_message=$(git log -1 --pretty=%B)
#Dump cef version info
cef_version=$(grep -o -P '(?<=CEF_VERSION \").*(?=\")' < CMakeLists.txt)
#Build final release information
#Tag
release_tag=$(echo "jcef-$commit_id+cef-$cef_version" | awk '{print}' ORS='')
echo "$release_tag" > ../release_tag.txt #Export for build_meta announcer
echo "release_tag_name=$release_tag" >> $GITHUB_ENV
#Name
echo "release_name=JCEF $commit_id + CEF $cef_version" >> $GITHUB_ENV
#Readme
(
echo "**Update JCEF to [$commit_id]($commit_url)**"
echo ""
echo "Build: [GitHub Actions #$4]($3)"
echo "JCEF version: $commit_id"
echo "CEF version: $cef_version"
echo ""
echo "Changes from previous release:"
echo "\`\`\`"
echo "$commit_message"
echo "\`\`\`"
echo "**NOTE:** The sources appended below are the sources of this repository, not JCEF. Please refer to the JCEF commit linked above to obtain sources of this build."
) > ../release_message.md
#Add LICENSE
mv LICENSE.txt ../LICENSE
#Build build_meta.json
(
echo "{"
echo " \"jcef_repository\": \"$1\", "
echo " \"jcef_commit\": \"$commit_id\", "
echo " \"jcef_commit_long\": \"$commit_id_long\", "
echo " \"jcef_url\": \"$commit_url\", "
echo " \"cef_version\": \"$cef_version\", "
echo " \"actions_url\": \"$3\", "
echo " \"actions_number\": \"$4\", "
echo " \"filename_linux_amd64\": \"linux-amd64.tar.gz\", "
echo " \"filename_linux_i386\": \"linux-i386.tar.gz\", "
echo " \"filename_windows_amd64\": \"windows-amd64.tar.gz\", "
echo " \"filename_windows_i386\": \"windows-i386.tar.gz\", "
echo " \"filename_macosx_amd64\": \"macosx-amd64.tar.gz\", "
echo " \"filename_macosx_arm64\": \"macosx-arm64.tar.gz\", "
echo " \"release_tag\": \"$release_tag\","
echo " \"release_url\": \"https://github.com/$5/releases/tag/$release_tag\", "
echo " \"download_url_linux_amd64\": \"https://github.com/$5/releases/download/$release_tag/linux-amd64.tar.gz\", "
echo " \"download_url_linux_i386\": \"https://github.com/$5/releases/download/$release_tag/linux-i386.tar.gz\", "
echo " \"download_url_windows_amd64\": \"https://github.com/$5/releases/download/$release_tag/windows-amd64.tar.gz\", "
echo " \"download_url_windows_i386\": \"https://github.com/$5/releases/download/$release_tag/windows-i386.tar.gz\", "
echo " \"download_url_macosx_amd64\": \"https://github.com/$5/releases/download/$release_tag/macosx-amd64.tar.gz\", "
echo " \"download_url_macosx_ard64\": \"https://github.com/$5/releases/download/$release_tag/macosx-arm64.tar.gz\", "
echo "}"
) > ../build_meta.json
#Cleanup
cd ..
rm -rf jcef