name: Nightly build MacOS ARM

on: [push]

jobs:
  build:

    runs-on: macos-latest

    steps:
    - uses: actions/checkout@v6

    - name: install_dependencies
      run: |
        brew install pkg-config libpng freetype zstd sdl2 fluidsynth

    - name: build
      run: |
        cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSIMUTRANS_UPDATE_LANGFILES=ON ..
        cmake --build build --target install

    - name: distribute
      run: |
        cd build
        zip -r simumac-nightly.zip simutrans

    - name: Update binaries of Nightly Release
      uses: svenstaro/upload-release-action@v2
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: build/simumac-nightly.zip
        asset_name: simumac-arm-nightly.zip
        tag: Nightly
        overwrite: true
