2024-02-16 12:13:24 +01:00
|
|
|
name: CI/CD Pipeline
|
|
|
|
|
|
|
|
on: push
|
|
|
|
|
2024-02-17 12:43:39 +01:00
|
|
|
env:
|
|
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
|
2024-02-16 12:13:24 +01:00
|
|
|
jobs:
|
2024-02-17 12:48:33 +01:00
|
|
|
deploy-main:
|
2024-02-16 12:13:24 +01:00
|
|
|
runs-on: ubuntu-latest
|
2024-02-18 16:07:11 +01:00
|
|
|
container: git.hofer.link/ruderverein-donau-linz/rowing-ci:20240215
|
2024-02-17 11:22:45 +01:00
|
|
|
if: github.ref == 'refs/heads/main'
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
2024-02-18 16:02:01 +01:00
|
|
|
|
2024-05-26 13:07:21 +02:00
|
|
|
- name: Set up cache laws
|
2024-02-18 16:07:11 +01:00
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
2024-02-18 16:13:51 +01:00
|
|
|
/root/.cache/risp
|
2024-02-19 18:29:16 +01:00
|
|
|
key: risp-cache-${{ hashFiles('**/laws/*') }}
|
|
|
|
restore-keys: risp-cache-
|
2024-02-18 16:07:11 +01:00
|
|
|
|
2024-05-26 13:07:21 +02:00
|
|
|
- name: Cache Cargo dependencies
|
|
|
|
uses: Swatinem/rust-cache@v2
|
2024-02-18 16:26:04 +01:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
cargo b --release
|
|
|
|
|
2024-02-17 11:22:45 +01:00
|
|
|
|
2024-02-18 16:02:01 +01:00
|
|
|
- name: Run
|
|
|
|
run: |
|
|
|
|
cargo r --release
|
|
|
|
|
|
|
|
- name: Deploy
|
2024-02-17 11:22:45 +01:00
|
|
|
run: |
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts
|
|
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
|
|
chmod 600 ~/.ssh/id_rsa
|
|
|
|
|
2024-10-17 16:01:10 +02:00
|
|
|
scp -C ./output/* $SSH_USER@$SSH_HOST:/var/www/html/ris/
|
2024-02-17 11:22:45 +01:00
|
|
|
env:
|
|
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|