name: Release
on:
  schedule:
    - cron: 0 0 * * *
  workflow_dispatch: ~
concurrency:
  group: run
  cancel-in-progress: true
jobs:
  run:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Setup Repo CR
        uses: actions/checkout@v6
        with:
          repository: xszo/cr
          path: cr
      - name: Setup Repo C-network
        uses: actions/checkout@v6
        with:
          repository: xszo/c-network
          path: c-network
      - name: Setup Python
        uses: actions/setup-python@v6
        with:
          python-version: ">=3.12"
      - name: Run C-network
        working-directory: c-network
        run: |
          ./run -a
          cp -rf out/* ../cr
      - name: Run CR
        working-directory: cr
        run: |
          (echo)> null
          git config user.name "github-actions"
          git config user.email "github-actions@github.com"
          git add --all
          git commit -mactions --amend --reset-author
          git push --force
