Skip to content

Updated: updated workflow #6

Updated: updated workflow

Updated: updated workflow #6

Workflow file for this run

name: Rust CI/CD Pipeline
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install Dependencies
run: cargo fetch
- name: Run Tests
run: cargo test
- name: Build Project
run: cargo build --release
timeout:
timeout-minutes: 1
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Monitor deployment for timeout and cancel if crossed the threshold
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
sleep 1m
gh -R {owner}/{repo} run list -w deploy.yml -s queued --json databaseId -q .[].databaseId | xargs gh -R {owner}/{repo} run cancel
deploy:
runs-on: self-hosted
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install Dependencies
run: cargo fetch
- name: Build Project
run: cargo build --release
- name: Deploy to Production
run: |
# Add your deployment script/command here
echo "Deploying to production..."