workflow
All checks were successful
/ Build BaseBand Website (push) Successful in 10s

This commit is contained in:
Daniella / Tove 2024-10-14 14:12:40 +02:00
parent d15a82d915
commit 291a86f159
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
3 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,26 @@
on: [ push ]
jobs:
make:
name: Build BaseBand Website
runs-on: 'docker'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Notify Action Start
run: bash scripts/webhook.sh "**(Website)** Updating..."
- name: Push to Prod Server
env:
SSH_PRIVATEKEY: ${{ secrets.SSH_PRIVATEKEY }}
GPG_PRIVATEKEY: ${{ secrets.GPG_PRIVATEKEY }}
BB_HOST: ${{ vars.BB_HOST }}
BB_PORT: ${{ vars.BB_PORT }}
BB_PATH: ${{ vars.BB_PATH }}
run: |
bash scripts/push_files.sh
- name: Notify Action Completion
if: always()
run: bash scripts/webhook.sh "**(Website)** Update complete!"

10
scripts/push_files.sh Normal file
View file

@ -0,0 +1,10 @@
#!/bin/bash
# DO NOT RUN THIS MANUALLY. PUSH TO RELEASE INSTEAD. ( <- unless there is an emergency.)
echo "$SSH_PRIVATEKEY" > ssh_key
chmod 700 ssh_key
scp -o StrictHostKeyChecking=no -i ssh_key -P "$BB_PORT" *.html *.spl *.css lorem-ipsum "root@$BB_HOST:$BB_PATH" &&
(ssh -o StrictHostKeyChecking=no -i ssh_key -p "$BB_PORT" "root@$BB_HOST" "cd $BB_PATH && bash reload.sh" || true)
rm ssh_key

1
scripts/webhook.sh Normal file
View file

@ -0,0 +1 @@
curl -i -s -o /dev/null -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"$*\n on $(basename "$(git describe --always --all)") with \`$(git log --no-abbrev --oneline | head -n1 | sed -E 's/\w+ (.*)/\1/g')\`\n at $(date)\"}" https://discord.com/api/webhooks/1250323633205940244/yu1v_moeBxWi4YWaRK_s4tNAXUGUJml-E2PbhToccVFo1Ax2_6Iq6R6lEONCKikHBBn4