Skip to content

Build and Release

Build and Release #11

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*' # Only runs on version tags like v1.0.0
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build
run: |
rustup target add x86_64-unknown-linux-gnu
cargo build --release --target x86_64-unknown-linux-gnu
- name: Upload Binary to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: ./target/x86_64-unknown-linux-gnu/release/oneAI-backend
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
- name: Deploy to EC2
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.EC2_HOST }}
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
source: ./target/x86_64-unknown-linux-gnu/release/oneAI-backend
target: /home/ubuntu/app
- name: Restart Backend via SSH
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.EC2_HOST }}
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd ~/app/target/x86_64-unknown-linux-gnu/release/OneLLM-Website && git pull && sudo systemctl restart oneai-backend.service