Add scripts to create releases of own projects on GitHub

This commit is contained in:
Martchus 2018-03-25 20:36:38 +02:00
parent 82614c8a18
commit 0945222d1f
3 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,34 @@
#!/usr/bin/bash
set -e # abort on first error
shopt -s nullglob
source versions.sh
# release latest version of my projects on GitHub (if not already released yet)
for project in "${!versions[@]}"
do
version=${versions[$project]}
gh_name=${github_names[$project]:-$project}
[[ $gh_name == 'skip' ]] && continue
[[ $version == 'none' ]] && continue
echo '------------------------------------------------------------------------'
echo "NEXT: $project -> $version"
# check whether release already exists
if github-release info --user martchus --repo "$gh_name" --tag "v$version"; then
echo "auto-skipping $project -> v$version; release already present"
continue
fi
# promt
read -p "release $project -> v$version [y/n]? " -n 1 -r
echo
[[ $REPLY =~ ^[Yy]$ ]] || continue
# create release
if github-release release --user martchus --repo "$gh_name" --tag "v$version"; then
echo "SUCCESS: released $project -> $version"
else
echo "FAILURE: unable to create release $project -> $version"
exit -1
fi
done

View File

@ -0,0 +1,50 @@
#!/usr/bin/bash
set -e # abort on first error
shopt -s nullglob
source versions.sh
repo_dir=${PATH_REPO_OWNSTUFF}
if ! [[ $repo_dir ]]; then
echo "\$PATH_REPO_OWNSTUFF is empty."
exit -1
fi
repo_dir+='/x86_64'
if ! [[ -d $repo_dir ]]; then
echo "\$PATH_REPO_OWNSTUFF/x86_64 does not point to a directory."
exit -1
fi
# upload latest static mingw-w64 package of my projects on GitHub (if not already present)
for project in "${!versions[@]}"
do
version=${versions[$project]}
gh_name=${github_names[$project]:-$project}
[[ $gh_name == 'skip' ]] && continue
[[ $version == 'none' ]] && continue
echo '------------------------------------------------------------------------'
echo "NEXT: $project/v$version"
# determine file path
files=("$repo_dir/mingw-w64-$project-static-$version"-*-*.pkg.tar.xz)
if [[ ${#files[@]} == 0 ]]; then
echo "no static mingw-w64 package for $project/v$version present"
continue
fi
latest_file=${files[-1]}
file_name=${latest_file##*/}
# check whether upload already exists
if github-release info --user martchus --repo "$gh_name" --tag "v$version" | grep "artefact: $latest_file"; then
echo "auto-skipping $project/v$version; $latest_file already present"
continue
fi
# upload file
echo "uploading $project/v$version -> $latest_file"
if github-release upload --user martchus --repo "$gh_name" --tag "v$version" --file "$latest_file" --name "$file_name"; then
echo "SUCCESS: uploaded $project/v$version -> $latest_file"
else
echo "FAILURE: unable to upload $project/v$version -> $latest_file"
exit -1
fi
done

View File

@ -13,3 +13,7 @@ declare -A versions=(
[dbus-soundrecorder]=1.2.2
[qt5]=5.10.1
)
declare -A github_names=(
[c++utilities]=cpp-utilities
[qt5]=skip
)