forked from SteamWar/SteamWar
Every project gets a checkAffected task that decides whether it has to
be rebuilt. A project is affected when one of these changed:
- its own files, or paths it adds with an affected { } block
- the versions of its resolved dependencies
- a project it depends on
- the root project, which owns the shared build and CI files
Projects list what they ship in a deploy { } block, and can add
afterDeploy commands there. Jars are now byte-reproducible. Only files
whose hash differs from the deployed one are uploaded, and only their
afterDeploy commands are run.
The deploy workflow diffs against the last deployed commit, which is
stored on the server with the dependency versions. PR builds diff
against the merge base. Shared setup steps moved into composite actions
under .gitea/actions.
33 lines
1.0 KiB
Bash
Executable File
33 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Usage: stage-artifacts.sh <state-dir> <output-dir> [projects]
|
|
#
|
|
# Copies the deployed files of the given projects to the output directory under their deployed name,
|
|
# skipping those identical to the deployed file, and lists the projects with copied files in
|
|
# state-dir/deployed-projects. Reads state-dir/deploy-artifacts ("<project> <build output> <deployed name>"
|
|
# per line, written by affected-projects.sh) and state-dir/deployed-hashes (sha256sum output of the deployed files).
|
|
|
|
set -euo pipefail
|
|
|
|
state="$1"
|
|
output="$2"
|
|
projects=" ${3:-} "
|
|
|
|
mkdir -p "$output"
|
|
: > "${state}/deployed-projects"
|
|
|
|
while read -r project source name; do
|
|
if [[ "$projects" != *" ${project} "* ]]; then
|
|
continue
|
|
fi
|
|
|
|
hash="$(sha256sum "$source" | cut -d ' ' -f 1)"
|
|
if grep -qxF "${hash} ${name}" "${state}/deployed-hashes"; then
|
|
echo "${name} from ${project} is unchanged"
|
|
else
|
|
echo "Staging ${name} from ${project}"
|
|
cp "$source" "${output}/${name}"
|
|
echo "$project" >> "${state}/deployed-projects"
|
|
fi
|
|
done < "${state}/deploy-artifacts"
|