kind: pipeline
type: docker
name: default

workspace:
    path: /drone/nami

steps:
    - name: composer_dev
      image: composer:2.2.7
      commands:
          - composer install --ignore-platform-reqs --no-dev

    - name: node
      image: node:18.13.0-slim
      commands:
          - npm ci  && npx mix build --production && npm run img && rm -R node_modules

    - name: compress
      image: php:8.1.6
      commands:
          - apt-get update -yqq
          - apt-get install -yqq zip tar
          - cd .. && tar -cvzf stepper-${DRONE_TAG}.tar.gz ./nami && mv stepper-${DRONE_TAG}.tar.gz nami/ && cd nami
          - cd .. && zip -r stepper-${DRONE_TAG}.zip ./nami && mv stepper-${DRONE_TAG}.zip nami/ && cd nami
      when:
          event: tag

    - name: gitea_release
      image: plugins/gitea-release
      settings:
          api_key:
              from_secret: gitea_api_key
          base_url: https://git.susy-system.de
          files: ./stepper-${DRONE_TAG}.*
      when:
          event: tag
