Add minimal configuration for builds.sr.ht

This commit is contained in:
Timothée Floure 2022-01-27 09:35:53 +01:00
parent f21b48eadf
commit ee541dad0a
Signed by: tfloure
GPG Key ID: 4502C902C00A1E12
2 changed files with 36 additions and 0 deletions

19
.build.yml Normal file
View File

@ -0,0 +1,19 @@
image: alpine/latest
packages:
- elixir
artifacts:
- ha-handler/_build/prod/rel/ha-handler.tar.gz
sources:
- https://code.recycled.cloud/RecycledCloud/ha-handler.git
tasks:
- setup: |
cd ha-handler
mix local.hex --force
mix local.rebar --force
mix deps.get
- release: |
cd ha-handler
MIX_ENV=prod mix compile
MIX_ENV=prod mix release
cd _build/prod/rel
tar cvzf ha-handler.tar.gz ha_handler/

17
run-ci.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
BUILDS_INSTANCE=https://builds.sr.ht
MANIFEST=.build.yml
if [ -z "$SRHT_ACCESS_TOKEN" ]; then
echo "Please set SRHT_ACCESS_TOKEN before calling this script." >&2
exit 1
fi
curl \
-H Authorization:"token $SRHT_ACCESS_TOKEN" \
--data "manifest=$(jq -R -r --slurp < $MANIFEST)" \
--data "note=recycledcloud-ha-handler" \
-X POST $BUILDS_INSTANCE/api/jobs | jq