1
0
mirror of https://github.com/PDP-10/its.git synced 2026-02-27 01:09:49 +00:00

Deploy built images using rsync.

This commit is contained in:
Lars Brinkhoff
2021-01-20 12:40:27 +01:00
parent 179c638407
commit 63a9b94a0e
2 changed files with 37 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ defaults:
jobs:
build:
environment: Deploy
runs-on: ${{matrix.os}}
strategy:
matrix:
@@ -22,3 +23,9 @@ jobs:
run: sh -ex build/dependencies.sh install_linux
- name: Build
run: make check-dirs all EMULATOR=${{matrix.emulator}}
- name: Deploy
if: github.ref == 'refs/heads/master'
env:
SECRET: ${{secrets.SECRET}}
EMULATOR: ${{matrix.emulator}}
run: sh build/deploy.sh

View File

@@ -1,5 +1,33 @@
#!/bin/sh
echo "Here we can do anything when deployment has finished."
echo "Such as kicking off a second build stage."
# At the $HOST, the $USER needs to have an .ssh directory with
# authorized_keys matching $SECRET.
set -e
HOST=hactrn.org
PORT=22
USER=images
DIR=/var/www/hactrn.org/images
SSH=$HOME/.ssh
ID=$SSH/id_rsa
if test -z "$SECRET"; then
echo 'ERROR: No key in $SECRET.'
exit 1
fi
mkdir -p $SSH
chmod 700 $SSH
echo "$SECRET" > $ID
chmod 600 $ID
ssh-keyscan -p $PORT -H $HOST >> ~/.ssh/known_hosts
(cd out; tar czf $EMULATOR.tgz $EMULATOR)
echo "Deploying to $USER@$HOST:$PORT"
rsync -av --inplace -e "ssh -p$PORT -l$USER" out/$EMULATOR.tgz $HOST:$DIR
exit 0