end-to-end/forgejo/build.sh

33 lines
851 B
Bash
Executable file

#!/bin/bash
# Copyright 2024 The Forgejo Authors
# SPDX-License-Identifier: MIT
set -ex
SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
version=$1
DIR=$2
v=$(echo $version | sed -E -e 's/([0-9]+\.[0-9]+).*/\1/')
read url ref semver < $SELF_DIR/sources/$v
rm -fr $DIR/src
if [[ "$ref" =~ ^refs/ ]] ; then
git clone --depth 1 $url $DIR/src
cd $DIR/src
git fetch origin +$ref:$ref
git checkout -b $v $ref
else
git clone --depth 1 -b $ref $url $DIR/src
cd $DIR/src
fi
export TAGS="bindata sqlite sqlite_unlock_notify"
make deps-backend backend
#
# use the gitea target here so that branches that do not contain the commit that adds
# the `forgejo` target to the Makefile can build successfully
#
make VERSION=v$version GITEA_VERSION=v$version FORGEJO_VERSION=$semver generate gitea
mv gitea $DIR/forgejo-$version