summaryrefslogtreecommitdiff
path: root/.ci-make.sh
diff options
context:
space:
mode:
authorcrystal <crystal@noreply.codeberg.org>2024-04-27 18:55:53 -0600
committercrystal <crystal@noreply.codeberg.org>2024-04-27 18:55:53 -0600
commit08f545c3661f36af1f4d493408ee6b00ac4bb223 (patch)
tree14087cbc55c44b457a342100698a49a107366b00 /.ci-make.sh
parent371709d63180b00e4ff59fe01cb9c336ec4b3f3a (diff)
[squash] Switch to Forgejo Actions
Diffstat (limited to '.ci-make.sh')
-rwxr-xr-x.ci-make.sh64
1 files changed, 63 insertions, 1 deletions
diff --git a/.ci-make.sh b/.ci-make.sh
index 7141acf..431cb4f 100755
--- a/.ci-make.sh
+++ b/.ci-make.sh
@@ -19,6 +19,40 @@ case "$1" in
make "$@"
exit $?
;;
+ "actions-prep")
+ case "$2" in
+ "build-forgejo-deb")
+ APREP_APT_EXTRAS="debhelper devscripts sudo"
+ ;;
+ "installtest")
+ APREP_APT_EXTRAS="sudo"
+ ;;
+ "")
+ APREP_APT_EXTRAS=
+ ;;
+ *)
+ echo "Invalid argument: $2"
+ exit 98
+ ;;
+ esac
+ EXIT_TOTAL=0
+ apt update
+ EXIT_TOTAL=$(($EXIT_TOTAL+$?))
+ apt upgrade -y
+ EXIT_TOTAL=$(($EXIT_TOTAL+$?))
+ if [ "$APREP_APT_EXTRAS" ] ; then
+ apt install $APREP_APT_EXTRAS -y
+ EXIT_TOTAL=$(($EXIT_TOTAL+$?))
+ fi
+ ACTIONS_FORGEJOSHA="$(git rev-parse --short=10 HEAD)"
+ if [ "$GITHUB_REF_TYPE" = "tag" ] ; then
+ echo "::set-output name=artifactlabel::$GITHUB_REF_NAME-$ACTIONS_FORGEJOSHA"
+ else
+ echo "::set-output name=artifactlabel::$ACTIONS_FORGEJOSHA"
+ fi
+ echo "::set-output name=forgejosha::$ACTIONS_FORGEJOSHA"
+ exit $EXIT_TOTAL
+ ;;
"ci-verify")
RETRY_LOOPS=0
while [ $RETRY_LOOPS -le $CI_VERIFY_RETRY_COUNT ] ; do
@@ -43,6 +77,26 @@ case "$1" in
exit 255
;;
"download-binary")
+ if [ "$GITHUB_REF_TYPE" = "tag" ] ; then
+ echo "INFO: Forgejo Actions mode!"
+ CI_COMMIT_TAG="$GITHUB_REF_NAME"
+ elif [ "$GITHUB_REF_TYPE" = "branch" ] ; then
+ echo "WARNING: Not building a tag! Simulating it..."
+ echo "(forgejo actions mode)"
+ echo "(this will test the binary packaging without cutting a tag in the package)"
+ echo "Resolving tag..."
+ cd forgejo
+ CI_COMMIT_TAG_RESOLVE=$(git tag --points-at HEAD)
+ if [ ! $CI_COMMIT_TAG_RESOLVE ] ; then
+ echo "Failed to resolve exact tag! Getting as close as we can..."
+ git describe --tags HEAD
+ CI_COMMIT_TAG_RESOLVE=$(git describe --tags HEAD --abbrev=0)
+ echo "Closest existing tag: $CI_COMMIT_TAG_RESOLVE"
+ fi
+ cd ..
+ echo "Proceeding with resolved tag: $CI_COMMIT_TAG_RESOLVE"
+ CI_COMMIT_TAG="$CI_COMMIT_TAG_RESOLVE"
+ fi
if [ $CI_COMMIT_TAG ] ; then
CI_RELEASE_ASSETS=$(curl $CI_VERIFY_API/api/v1/repos/$CI_VERIFY_REPO/releases/tags/$CI_COMMIT_TAG | jq -c '.assets[]' | grep linux-amd64)
CI_RELEASE_BINARY_URL=$(echo "$CI_RELEASE_ASSETS" | grep linux-amd64\" | jq -r --jsonargs .browser_download_url)
@@ -77,9 +131,17 @@ case "$1" in
cat deb/.forgejo-bin.control >> deb/debian/control
fi
;;
+ "package-build-deps")
+ cd deb
+ mk-build-deps --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" --remove
+ exit $?
+ ;;
"package-build")
cd deb
- dpkg-buildpackage -b
+ if [ "$2" = "actions" ] ; then
+ PACKAGE_BUILD_EXTRA_ARGS="--no-sign"
+ fi
+ dpkg-buildpackage -b $PACKAGE_BUILD_EXTRA_ARGS
exit $?
;;
"package-clean")