name: Deploy on: push: branches: [ "main" ] env: CARGO_TERM_COLOR: always jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Cache Cargo binaries uses: actions/cache@v3 with: path: ~/.cargo/bin - uses: extractions/setup-just@v1 - uses: oven-sh/setup-bun@v1 with: bun-version: latest - name: Install frontend run: bun install --frozen-lockfile --cwd frontend - name: Build frontend run: just build-frontend - run: rustup toolchain install stable --profile minimal - uses: Swatinem/rust-cache@v2 - name: Install sqlx-cli run: cargo install sqlx-cli --no-default-features --features native-tls,postgres - name: Run tests run: cargo test --verbose - name: Build backend run: cargo build --release --verbose - name: Install SSH Key uses: shimataro/ssh-key-action@v2 with: key: ${{ secrets.SSH_PRIVATE_KEY }} known_hosts: 'just-a-placeholder-so-we-dont-get-errors' - name: Adding Known Hosts run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts - name: Deploy frontend with rsync run: rsync -avz ./static/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/crawlnicle/crawlnicle/static/ - name: Deploy backend with rsync run: rsync -avz ./target/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/home/crawlnicle/crawlnicle/target/