Files
Shiroha/scripts/SetENV.sh
T
Bacteria 136832e0de CI: refine build numbering, release/publish flow
Compute BUILD_NUMBER relative to the last gradle.properties mcVersion change (instead of total commits), add dependabot groups for actions and gradle deps, and simplify release notes formatting (disable generated notes and inline metadata). Remove the Publish-To-Repo step from the main build workflow and add a force-push input/conditional to publish-api workflow. Invoke scripts/SetENV.sh in publish-api and update SetENV.sh to produce jar names that omit run attempt suffix for first run. These changes tighten publishing controls and make build numbering reflect per-version increments.
2026-07-09 20:17:09 +08:00

67 lines
1.8 KiB
Bash

#!/bin/sh
# Camellia CI - Environment Setup Script
# Reads gradle.properties and sets GitHub Actions environment variables
prop() {
grep "^[[:space:]]*${1}" gradle.properties | cut -d'=' -f2 | sed 's/^[[:space:]]*//; s/\r//'
}
project_id="camellia"
project_id_b="Camellia"
commitid=$(git log --pretty='%h' -1)
mcversion=$(prop mcVersion)
release=$(prop release)
pushRepo=$(prop pushRepo)
release_tag="$mcversion-$commitid"
run_attempt="${GITHUB_RUN_ATTEMPT:-1}"
if [ "$run_attempt" = "1" ]; then
jarName="$project_id-$mcversion-$BUILD_NUMBER.jar"
else
jarName="$project_id-$mcversion-$BUILD_NUMBER-$run_attempt.jar"
fi
jarName_dir="camellia-server/build/libs/$jarName"
flag_push_repo=false
flag_release=false
pre=false
make_latest=false
if [ "$release" = "pre" ]; then
pre=true
flag_release=true
make_latest=true
flag_push_repo=true
elif [ "$release" = "true" ]; then
flag_release=true
make_latest=true
flag_push_repo=true
fi
if [ "$pushRepo" = "true" ]; then
flag_push_repo=true
elif [ "$pushRepo" = "false" ]; then
flag_push_repo=false
fi
# Rename the paperclip jar to a standardized name
actual_jar=$(ls camellia-server/build/libs/*-paperclip-*.jar 2>/dev/null | head -n 1)
if [ -n "$actual_jar" ]; then
mv "$actual_jar" "$jarName_dir"
else
echo "Warning: No paperclip jar found to rename"
fi
echo "project_id=$project_id" >> $GITHUB_ENV
echo "project_id_b=$project_id_b" >> $GITHUB_ENV
echo "commit_id=$commitid" >> $GITHUB_ENV
echo "commit_msg=$(git log --pretty='> [%h] %s' -1)" >> $GITHUB_ENV
echo "mcversion=$mcversion" >> $GITHUB_ENV
echo "pre=$pre" >> $GITHUB_ENV
echo "tag=$release_tag" >> $GITHUB_ENV
echo "jar=$jarName" >> $GITHUB_ENV
echo "jar_dir=$jarName_dir" >> $GITHUB_ENV
echo "flag_push_repo=$flag_push_repo" >> $GITHUB_ENV
echo "flag_release=$flag_release" >> $GITHUB_ENV
echo "make_latest=$make_latest" >> $GITHUB_ENV