From 4d8880b65d8973875d5d2b885f7d3b67eaf80bc1 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Wed, 5 May 2021 07:05:51 +0200 Subject: [PATCH] initial commit of the release script --- do-friendica-release.sh | 114 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100755 do-friendica-release.sh diff --git a/do-friendica-release.sh b/do-friendica-release.sh new file mode 100755 index 0000000..9f17d40 --- /dev/null +++ b/do-friendica-release.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +# This script creates archives for the Friendica core and the addons +# from the current state of the repositories. The core archive will +# contain the composer dependencies. +# +# The naming scheme for the archives will be +# friendica-full-{$VERSION].tar.gz +# friendica-addons-{$VERSION}.tar.gz +# +# Additionally the SHA256 check sums will be calculated and piped into +# a text file. +# +# Parameters +# You have to supply the script a "Version Number" that will be used +# as hinted above. It can be anything, but you should stick to the +# current versioning scheme of Friendica. +# +# USAGE +# 1. prepare the core directory to reflext the state you want to pack +# e.g. the stable release of Friendica +# 2. prepare the addons directory +# 3. run this script with the version as one and only parameter +# +# Copyright (C) 2020 Tobias Diekershoff +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +if [ $# -eq 0 ] + then + echo "You need to supply the version that shall be used in the file names" + exit 1 +fi + +CORE="./friendica" +ADDONS="./friendica-addons" +VERSION=$1 +RELEASECORE="$CORE-full-$VERSION" +RELEASEADDONS="$ADDONS-$VERSION" + +read -p " > The repositories are in the state they should be for packing? y/n " CONT +if [ "$CONT" = "y" ]; then + echo "ok. packing the archives"; +else + echo "No Friendica packages created"; + exit 0 +fi + +echo "copying the directories to temporary build directories" +mkdir $RELEASECORE +cp -r $CORE "$RELEASECORE/$RELEASECORE" +cp -r $ADDONS "$RELEASEADDONS" + +# delete some unneeded files and directories from the repos + +echo "cleaning unneded stuff from the core directory" +( cd $RELEASECORE/$RELEASECORE +echo "fetching dependencies with composer" +php7.0 bin/composer.phar install --quiet --no-dev +rm -rf .git .github .tx test +rm -rf .codecov.yml .editorconfig .gitattributes .gitignore .gitmodules .php_cs.dist autotest.sh composer.json composer.lock Doxyfile +) + +echo "cleaning unneded stuff from the addon directory" +( cd $RELEASEADDONS +rm -rf .git .tx +rm -rf .editorconfig .gitattributes .gitignore +) + +# create tar archives +echo "creating tar archives" +tar -czf $RELEASECORE.tar.gz -C $RELEASECORE . +tar -czf $RELEASEADDONS.tar.gz -C $RELEASEADDONS . + +# create SHA256 sum files +echo "calculating SHA256 checksums" +sha256sum $RELEASECORE.tar.gz > $RELEASECORE.tar.gz.sum256 +sha256sum $RELEASEADDONS.tar.gz > $RELEASEADDONS.tar.gz.sum256 + +echo "all done please check the check sums." +cat $RELEASECORE.tar.gz.sum256 +sha256sum $RELEASECORE.tar.gz + +cat $RELEASEADDONS.tar.gz.sum256 +sha256sum $RELEASEADDONS.tar.gz + +echo "cleaning up" +rm -rf $RELEASECORE +rm -rf $RELEASEADDONS + +read -p " > copy the files to git.friendi.ca? y/n " CONT +if [ "$CONT" = "y" ]; then + echo "copying files"; + scp $RELEASECORE.tar.gz $RELEASECORE.tar.gz.sum256 $RELEASEADDONS.tar.gz $RELEASEADDONS.tar.gz.sum256 git.friendi.ca:/srv/http/ +else + echo "Archives not copied to the files server"; + exit 0 +fi