2024-01-08 23:48:46 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# this is intended to be used from within a GitHub action. Without the required
|
|
|
|
# token this will not work when run from the command line
|
|
|
|
# call it from the default position in the filesystem (which is inside the subsurface git tree)
|
|
|
|
#
|
2024-01-10 15:11:27 +00:00
|
|
|
# Usage: get-atomic-buildnr.sh SHA secrets.NIGHTLY_BUILDS [extra-name-component]
|
|
|
|
#
|
|
|
|
|
2024-01-08 23:48:46 +00:00
|
|
|
# checkout the nightly-builds repo in parallel to the main repo
|
|
|
|
# the clone followed by the pointless push should verify that the password is stored in the config
|
|
|
|
# that way the script doesn't need the password
|
2024-01-11 00:36:09 +00:00
|
|
|
SCRIPT_SOURCE=$(dirname "${BASH_SOURCE[0]}")
|
|
|
|
PARENT_DIR=$(cd "$SCRIPT_SOURCE"/../.. && pwd)
|
2024-01-08 23:48:46 +00:00
|
|
|
url="https://subsurface:$2@github.com/subsurface/nightly-builds"
|
2024-01-11 00:36:09 +00:00
|
|
|
cd "$PARENT_DIR"
|
2024-01-08 23:48:46 +00:00
|
|
|
git clone -b main https://github.com/subsurface/nightly-builds
|
|
|
|
cd nightly-builds
|
|
|
|
git remote set-url origin "$url"
|
|
|
|
git push origin main
|
2024-01-10 15:11:27 +00:00
|
|
|
echo "build number prior to get-or-create was $(<latest-subsurface-buildnumber)"
|
2024-01-11 00:36:09 +00:00
|
|
|
cd "$PARENT_DIR"
|
2024-01-11 01:44:48 +00:00
|
|
|
bash subsurface/scripts/get-or-create-build-nr.sh "$1"
|
2024-01-10 21:31:44 +00:00
|
|
|
echo "build number after get-or-create is $(<nightly-builds/latest-subsurface-buildnumber)"
|
2024-01-11 00:36:09 +00:00
|
|
|
cp nightly-builds/latest-subsurface-buildnumber subsurface/
|
2024-01-08 23:48:46 +00:00
|
|
|
[[ -n $3 ]] && echo "$3" > subsurface/latest-subsurface-buildnumber-extension
|