This commit is contained in:
philipp 2023-07-30 17:56:32 +02:00
parent 82a55c48b5
commit d2f6e37725

View File

@ -5,8 +5,7 @@ variables:
before_script: before_script:
- rustup target add $CARGO_TARGET - rustup target add $CARGO_TARGET
- apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools - apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 && ./test_db.sh
- apt update && apt install -y sqlite3 && ./test_db.sh
build: build:
stage: build stage: build
@ -33,12 +32,13 @@ deploy-staging:
- chmod 700 ~/.ssh - chmod 700 ~/.ssh
- ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts
script: script:
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging' - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/rot-updating
- scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging
- ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir -p /home/k004373/rowing-staging/svelte/build'
- scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/
- scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/
- scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing-staging/
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging'
- ssh $SSH_USER@$SSH_HOST 'rm /home/k004373/rowing-staging/db.sqlite && cp /home/k004373/rowing/db.sqlite /home/k004373/rowing-staging/db.sqlite && mkdir -p /home/k004373/rowing-staging/svelte/build'
- mv /home/k004373/rowing-staging/rot-updating /home/k004373/rowing-staging/rot
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rotstaging' - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rotstaging'
only: only:
- staging - staging
@ -53,12 +53,13 @@ deploy-main:
- chmod 700 ~/.ssh - chmod 700 ~/.ssh
- ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts - ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts
script: script:
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rot' - scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing/rot-updating
- scp target/$CARGO_TARGET/release/rot $SSH_USER@$SSH_HOST:/home/k004373/rowing
- scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r static $SSH_USER@$SSH_HOST:/home/k004373/rowing/
- scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r templates $SSH_USER@$SSH_HOST:/home/k004373/rowing/
- scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/ - scp -r svelte $SSH_USER@$SSH_HOST:/home/k004373/rowing/
- ssh $SSH_USER@$SSH_HOST 'mkdir -p /home/k004373/rowing-staging/svelte/build' - ssh $SSH_USER@$SSH_HOST 'mkdir -p /home/k004373/rowing/svelte/build'
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl stop rotstaging'
- mv /home/k004373/rowing/rot-updating /home/k004373/rowing/rot
- ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot' - ssh $SSH_USER@$SSH_HOST 'sudo systemctl start rot'
only: only:
- main - main