Skip to content

Commit

Permalink
add deployment hook for thilo-billerbeck.com
Browse files Browse the repository at this point in the history
  • Loading branch information
thilobillerbeck committed Dec 21, 2023
1 parent d9526be commit fc7e46d
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 16 deletions.
50 changes: 50 additions & 0 deletions machines/bart/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ let
docker compose up --build -d
'';
};
thiloBillerbeckComDeployScript = pkgs.writeShellApplication {
name = "deploy-thilo-billerbeck.com-hook";

runtimeInputs = with pkgs; [ curl unzip rsync ];

text = ''
mkdir -p /tmp/thilo-billerbeck.com
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $2" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/thilobillerbeck/thilo-billerbeck-com/actions/artifacts/$1/zip" > /tmp/thilo-billerbeck.com/artifact.zip
unzip -o /tmp/thilo-billerbeck.com/artifact.zip -d /tmp/thilo-billerbeck.com
rm /tmp/thilo-billerbeck.com/artifact.zip
rsync -avzr --delete --omit-dir-times --no-perms /tmp/thilo-billerbeck.com/ /var/www/thilo-billerbeck.com/
rm -rf /tmp/thilo-billerbeck.com
'';
};
in
{
imports = [
Expand Down Expand Up @@ -249,6 +267,38 @@ in
user = "deploy";
group = "deploy";
hooksTemplated = {
thilo-billerbeck-com-deploy = ''
{
"id": "thilo-billerbeck-com-deploy",
"execute-command": "${thiloBillerbeckComDeployScript}/bin/deploy-thilo-billerbeck.com-hook",
"include-command-output-in-response": true,
"include-command-output-in-response-on-error": true,
"pass-arguments-to-command":
[
{
"source": "url",
"name": "artifact"
},
{
"source": "string",
"name": "{{ getenv "GITHUB_TOKEN" | js }}"
},
],
"trigger-rule":
{
"match":
{
"type": "value",
"value": "{{ getenv "WEBHOOK_SECRET" | js }}",
"parameter":
{
"source": "url",
"name": "token"
}
}
}
}
'';
skymoth-deploy = ''
{
"id": "skymoth-deploy",
Expand Down
33 changes: 17 additions & 16 deletions secrets/webhooksecret.age
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
age-encryption.org/v1
-> ssh-ed25519 3nl27g uwZgXu+DONcEvKo5ikYoR353ffa8omfaq76WwuOsIDQ
Gj+l0fEFjhriKYvZtf6rbskDar/+MpH1q7UAsxk783U
-> ssh-ed25519 lvnd2w xlp9/MhsURQeTu/N1tOKiWuW0FnaHY21G4H9MFiYgCY
KIwmJCZEY9w6wJpsOkoyxf3xNtyeU0gDZIyD4itIsuM
-> ssh-ed25519 xZYWOQ z1CWerefme6Z3jyMetclgxS+7lbn4WVR3JE0anmzZRY
EceVlXoNMQg1nT6AHt5aO01AV6z34lC+ujei29FxYlk
-> ssh-ed25519 SWxXuw jBgPvBT4WZVHra2owW04SWZTRwcPxEmqLCRY0Jc9in4
oITMaV3TrvwNmECmmmdOTvjwY0aahh2O2H6m5QwbtJE
-> ssh-ed25519 myimvQ yIFiShgjusK6TqwQvbTxYc4SN6eWz2+Lwt2cKq77mHE
E3msD/Q47EtFhjAqr+FRP/n8vVMLFj2kN3lPjJswnnM
-> ssh-ed25519 cya4Rg jYNFnqQ/LaK9MUA+DcbocCKiWj5qPbB873HWzGELEC0
/8M0eFmCdA63GhefKY6kO2dFc+pB+3wPOIyzSMCw8Jw
-> GE-grease T\5(y
pG1E54x/stTzm81C
--- lQeiISsCXWAeSYlBAFQepHEU6NyfcqvUtX6fRaj6+PI
'q L0pi�գք�S% [�J����{��2u�,mU��ұ#^���?�덌:�[�����y6�z|�x�Y���
-> ssh-ed25519 3nl27g mQTiysJASKyL99eRnqXqJFPogOiX05QdRKclnXdKCWA
1tMifr7xQrmhlgR0uTUB9qWyaULpLavhsrW+YXvIIiU
-> ssh-ed25519 lvnd2w HCckc6RIIc/t2XUXsXmESddwhQqsAyJ4geD+uCkdkhI
LfFCQzMubGeDNAgyRXs8v/lWIvQSNOWhvkHUuK12XNk
-> ssh-ed25519 xZYWOQ G4PPR603QWdLc40CvQjDHT0xhDFObA1NTxXI09djlnI
qYM6OLuL0yqHo9jkLLHwB/n4hJLx1PBS2KWdnhwaTr0
-> ssh-ed25519 SWxXuw kxOZm+acYUvoXH1sgcrllSirwQ7YMU2d+zFNoWGfH0k
g1ZGnYG1FtB+ngo7DTNrqVvPqpsPZD5gu7T3afxM0/A
-> ssh-ed25519 myimvQ SO8n/IP9HXaZXllfBaLAu1pvV4gV+O3uaUxo59Nt/zY
PY/iU1IIgq3JL9OydB9vWPLfhgxLACKA5mX0NchR87A
-> ssh-ed25519 cya4Rg AjvNWyuZpiPnQ1lvdQ8kZP7RJejyJSYYwQp3bH+SeW8
JT1u/jDViRf9rPTxcRV1xD21sYaixWN4Qc0EgvWWyG0
-> m0l7n0-grease kK$ F]Y"=@+U
cbnK+bWY9RHK27TEvgsocFPK5uoDqdn0aZ3ed1wEXauRoZAytp0tGoaBq3qqJ+tQ
ZqFm77TS54lLCc1X
--- sDDs5+EVuclsNO1HBitWCBN5uQD3/IjFZcdSswwL5Lg
��r)��= á�rhb��6y0K`5C���q.J�P��E:��f��m�W�J��v*b����n�j7��#��C�Py�n �����)<�r��D_&�H�u5Wv9�py��2��<�n&�MW���� s-��
Expand Down

0 comments on commit fc7e46d

Please sign in to comment.