diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..9b40c4a --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -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!" diff --git a/scripts/push_files.sh b/scripts/push_files.sh new file mode 100644 index 0000000..65f61ad --- /dev/null +++ b/scripts/push_files.sh @@ -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 diff --git a/scripts/webhook.sh b/scripts/webhook.sh new file mode 100644 index 0000000..218d9f6 --- /dev/null +++ b/scripts/webhook.sh @@ -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 \ No newline at end of file