move ci job scipts into an actual script

This will make it possible/easier to:

* share code between jobs
* run jobs locally
This commit is contained in:
Charles Hall 2024-12-01 16:23:26 -08:00
parent d4ffa78979
commit 540cc89c83
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
3 changed files with 57 additions and 6 deletions

52
bin/job Executable file
View file

@ -0,0 +1,52 @@
#!/usr/bin/env bash
job_artifacts() (
set -euo pipefail
nix-build-and-cache packages
)
job_ci() (
set -euo pipefail
nix-build-and-cache ci
direnv exec . engage
)
job_pages() (
set -euo pipefail
nix build .#website-root
cp --recursive --dereference result public
)
bail() (
set -euo pipefail
echo
echo "Job failed"
exit 1
)
run() (
set -euo pipefail
if [[ -z "${1+x}" ]]; then
echo "You must supply a job to run. Available jobs:"
declare -F | rg \
--only-matching \
--color never \
--replace '* $1' \
'^declare -f job_(.*)$'
exit 1
fi
job="$1"
cd "$(git rev-parse --show-toplevel)"
job_"$job" || bail
)
run "$@"