name: gbserver Rust CI/CD on: push: branches: ["main"] pull_request: branches: ["main"] jobs: build-and-deploy: runs-on: gbo steps: - uses: actions/checkout@v4 - name: Install Rust uses: actions-rs/toolchain@v1 with: toolchain: stable profile: minimal override: true components: rustfmt, clippy - name: Cache cargo registry uses: actions/cache@v3 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo- - name: Build release binary uses: actions-rs/cargo@v1 with: command: build args: --release --locked - name: Run tests uses: actions-rs/cargo@v1 with: command: test args: --release - name: Deploy binary run: | sudo cp ./target/release/gbserver /opt/gbo/bin/bot sudo chmod +x /opt/gbo/bin/bot/gbserver sudo systemctl restart gbserver