kind: pipeline
type: docker
name: build-release

trigger:
  event:
    - tag
  ref:
    - refs/tags/v*

steps:
  - name: build
    image: alpine:latest
    commands:
      - apk add --no-cache bash zip
      - VERSION=${DRONE_TAG#v}
      - mkdir -p build/fix-plugin-does-not-exist-notices
      - cp fix-plugin-does-not-exist-notices.php build/fix-plugin-does-not-exist-notices/
      - cp readme.txt build/fix-plugin-does-not-exist-notices/
      - cp LICENSE build/fix-plugin-does-not-exist-notices/
      - cp README.md build/fix-plugin-does-not-exist-notices/
      - cp CHANGELOG.md build/fix-plugin-does-not-exist-notices/
      - cd build
      - zip -r ../fix-plugin-does-not-exist-notices-$VERSION.zip fix-plugin-does-not-exist-notices
      - cd ..

  - name: release
    image: plugins/gitea-release
    settings:
      api_key:
        from_secret: gitea_token
      base_url: https://gitea.wpallstars.com
      files:
        - fix-plugin-does-not-exist-notices-*.zip
      title: Release ${DRONE_TAG}
      note: |
        Fix 'Plugin file does not exist.' Notices ${DRONE_TAG}

        See [CHANGELOG.md](https://gitea.wpallstars.com/wpallstars/fix-plugin-does-not-exist-notices/src/branch/main/CHANGELOG.md) for details.