maren/more-ci-work #4

Merged
oxaliq merged 7 commits from maren/more-ci-work into main 2024-01-08 15:23:09 +00:00
3 changed files with 18 additions and 9 deletions
Showing only changes of commit 9b958a1fc9 - Show all commits

View file

@ -18,7 +18,14 @@ steps:
secrets: secrets:
- deploy_ssh_key - deploy_ssh_key
commands: commands:
- ./.woodpecker/ssh.sh - echo "SETTING UP SSH"
- apk add openssh-client
- mkdir -p $HOME/.ssh
- ssh-keyscan -t ed25519 turtle.hup.is >> $HOME/.ssh/known_hosts
- echo "$DEPLOY_SSH_KEY" > $HOME/.ssh/id_ed25519
- chmod 0600 $HOME/.ssh/id_ed25519
- echo "SSH SETUP DONE"
- echo "RUNNING DEPLOY SCRIPT"
- ./.woodpecker/deploy.sh - ./.woodpecker/deploy.sh
when: when:
# Only try to deploy if previous step is successful # Only try to deploy if previous step is successful

View file

@ -4,20 +4,29 @@
host=deploy@turtle.hup.is host=deploy@turtle.hup.is
# organize the files # organize the files
echo "ORGANIZING THE FILES NICELY"
mkdir oxaliq mkdir oxaliq
mv dist oxaliq/. mv dist oxaliq/.
mv source oxaliq/. mv source oxaliq/.
mv static oxaliq/. mv static oxaliq/.
# put them on the deployment target # put them on the deployment target
echo "COPYING FILES TO DEPLOYMENT TARGET"
scp -r oxaliq "$host":~/ scp -r oxaliq "$host":~/
# do everything on the server that's necessary to run the new thing # do everything on the server that's necessary to run the new thing
# TODO make this not remove the old-working version until # TODO make this not remove the old-working version until
# the new version is confirmed working # the new version is confirmed working
ssh $host 'echo "does this ls show up in UI?" && ls -la' echo "SETTING OWNERSHIP AND PERMISSIONS"
ssh $host 'sudo chown -R sorreldotdev:sorreldotdev oxaliq/' ssh $host 'sudo chown -R sorreldotdev:sorreldotdev oxaliq/'
ssh $host 'sudo chmod -R 755 oxaliq/' ssh $host 'sudo chmod -R 755 oxaliq/'
echo "REPLACING PREVIOUS DEPLOYMENT"
ssh $host 'sudo rm -rf /srv/oxaliq || true' ssh $host 'sudo rm -rf /srv/oxaliq || true'
ssh $host 'sudo mv oxaliq /srv/.' ssh $host 'sudo mv oxaliq /srv/.'
echo "RESTARTING SERVICE"
ssh $host 'sudo systemctl restart sorreldotdev.service' ssh $host 'sudo systemctl restart sorreldotdev.service'
echo "SUCCESS!"
exit 0

View file

@ -1,7 +0,0 @@
#!/bin/sh -e
apk add openssh-client
mkdir -p $HOME/.ssh
ssh-keyscan -t ed25519 turtle.hup.is >> $HOME/.ssh/known_hosts
echo "$DEPLOY_SSH_KEY" > $HOME/.ssh/id_ed25519
chmod 0600 $HOME/.ssh/id_ed25519