-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
26,279 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Build and Deploy | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Build Docker image | ||
run: docker build -t qcext-server . | ||
|
||
- name: Save Docker image | ||
run: docker save -o qcext-server.tar qcext-server | ||
|
||
- name: Compress Docker image | ||
run: bzip2 -z qcext-server.tar | ||
|
||
- name: Deploy | ||
run: docker-compose run deploy | ||
env: | ||
DEPLOY_KEY: ${{ secrets.deploy_key }} | ||
DEPLOY_TARGET: ${{ secrets.deploy_target }} | ||
DEPLOY_USER: ${{ secrets.deploy_user }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
|
||
# Instantly exits our script whenever an error occurs | ||
set -e | ||
|
||
# Pipe our environmental SSH key variable into a file | ||
mkdir -p $HOME/.ssh | ||
echo "${deploy_key}" > $HOME/.ssh/deploy_key | ||
chmod 600 $HOME/.ssh/deploy_key # SSH keys need to be readonly | ||
|
||
# Where to deploy our site on our server | ||
target="/home/${deploy_user}/qcext-server/staging" | ||
|
||
# The actual deployment | ||
sh -c "rsync -azvh -e 'ssh -i $HOME/.ssh/deploy_key -o StrictHostKeyChecking=no' qcext-server.tar.bz2 ${deploy_user}@${deploy_target}:${target}" | ||
|
||
# Run update script | ||
sh -c "ssh -i $HOME/.ssh/deploy_key -o StrictHostKeyChecking=no ${deploy_user}@${deploy_target} 'cd ${target}; ./update.sh'" | ||
|
||
# Remove our deploy_key again since it's no longer needed | ||
rm $HOME/.ssh/deploy_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: '3' | ||
|
||
services: | ||
deploy: | ||
image: 'instrumentisto/rsync-ssh' | ||
volumes: | ||
- .:/home/site | ||
working_dir: /home/site | ||
environment: | ||
deploy_key: $DEPLOY_KEY | ||
deploy_target: $DEPLOY_TARGET | ||
deploy_user: $DEPLOY_USER | ||
command: sh deploy.sh |
Oops, something went wrong.