on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Setup Rust
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable

      - name: Install kinetics
        uses: taiki-e/cache-cargo-install-action@v2
        with:
          tool: kinetics

      - name: Install zig
        uses: goto-bus-stop/setup-zig@v2
        with:
          version: 0.13.0

      - name: Install cargo lambda
        uses: zerj9/setup-cargo-lambda@v0.1.2

      - name: Cache kinetics build
        id: cache-kinetics-build
        uses: actions/cache@v4
        with:
          path: ~/.kinetics
          key: ${{ runner.os }}-kinetics-build

      - name: Run kinetics deploy
        env:
          DEPLOY_DIR: PLACEHOLDER_DIR_PATH
          KINETICS_ACCESS_TOKEN: ${{ secrets.KINETICS_ACCESS_TOKEN }}
        run: |
          cd "${DEPLOY_DIR:-.}"
          kinetics deploy --max-concurrency=1
