name: tinymist::assets::publish
on:
  workflow_dispatch:

env:
  RUSTFLAGS: '-Dwarnings'

jobs:

  publish-crates:
    name: build 
    runs-on: ubuntu-22.04
    env:
      CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: recursive
      - uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          cache: false
      - name: Install Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 24
          cache: 'yarn'
      - name: Install llvm
        run: |
          sudo apt-get update
          sudo apt-get install llvm
      - name: Install deps
        run: yarn install
      - name: Check and build assets
        run: |
          yarn build:preview
          yarn build:l10n
      - name: Publish crates
        run: |
          cargo publish --allow-dirty --no-verify -p tinymist-assets || true
      - name: Verifies crate health (Optional)
        run: |
          cargo publish --allow-dirty --dry-run -p tinymist-assets
