philipp
569cb08a6d
All checks were successful
CI/CD Pipeline / deploy-main (push) Successful in 25m59s
51 lines
1.2 KiB
YAML
51 lines
1.2 KiB
YAML
name: CI/CD Pipeline
|
|
|
|
on: push
|
|
|
|
env:
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
jobs:
|
|
deploy-main:
|
|
runs-on: ubuntu-latest
|
|
container: git.hofer.link/ruderverein-donau-linz/rowing-ci:20240215
|
|
if: github.ref == 'refs/heads/main'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up cache laws
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
/root/.cache/risp
|
|
key: risp-cache-${{ hashFiles('**/laws/*') }}
|
|
restore-keys: risp-cache-
|
|
|
|
- name: Cache Cargo dependencies
|
|
uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Build
|
|
run: |
|
|
cargo b --release
|
|
|
|
|
|
- name: Run
|
|
run: |
|
|
cargo r --release
|
|
|
|
- name: Deploy
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
|
|
scp ./output/* $SSH_USER@$SSH_HOST:/var/www/html/ris/
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|