website-risg/.gitea/workflows/action.yml

59 lines
1.5 KiB
YAML
Raw Normal View History

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-02-18 16:07:11 +01:00
- name: Set up cargo cache laws
uses: actions/cache@v3
with:
path: |
2024-02-18 16:13:51 +01:00
/root/.cache/risp
2024-02-18 16:07:11 +01:00
key: laws
- name: Set up cargo cache rust
2024-02-18 16:02:01 +01:00
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-release-
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-02-17 13:33:56 +01:00
scp ./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 }}