kind: pipeline
type: docker
name: default

steps:
  - name: build
    image: python:3.9
    commands:
      - apt-get update && apt-get install -y --no-install-recommends patchelf
      - python -m venv venv
      - chmod +x venv/bin/activate
      - ./venv/bin/activate
      - pip install -r requirements.txt
      - python -m nuitka --standalone --onefile --enable-plugin=tk-inter src/LaunchSim.py

  - name: push-artifacts
    image: alpine/git
    environment:
      GIT_USERNAME:
        from_secret: GIT_USERNAME
      GIT_PASSWORD:
        from_secret: GIT_PASSWORD
    commands:
      - git config --global user.name "Drone CI"
      - git config --global user.email "drone@spark-ops.com"
      - git clone https://$GIT_USERNAME:$GIT_PASSWORD@git.spark-ops.com/LaunchSim/application.git
      - cp README_APP.md LaunchSim.dist/LaunchSim.exe application/
      - VERSION=$(cat VERSION)
      - cd application
      - git add .
      - git commit -m "Actualización de v$VERSION"
      - git push origin main
