diff --git a/.gitignore b/.gitignore index 54895a2..ca28149 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ out -tools/*.txt -tools/*.md -tools/*.json -tools/LICENSE +release_gen/*.txt +release_gen/*.md +release_gen/*.json +release_gen/LICENSE diff --git a/release_gen/announce_build_meta.sh b/release_gen/announce_build_meta.sh new file mode 100644 index 0000000..8aff172 --- /dev/null +++ b/release_gen/announce_build_meta.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ ! $# -eq 1 ] + then + echo "Usage: ./announce_build_meta.sh " + 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 diff --git a/release_gen/create_release_info.sh b/release_gen/create_release_info.sh new file mode 100755 index 0000000..402c699 --- /dev/null +++ b/release_gen/create_release_info.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +if [ ! $# -eq 5 ] + then + echo "Usage: ./create_release_info.sh " + 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