name: Release

on:
  push:
    tags:
      - '*'

jobs:

  release:
    name: Release
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Set up Go
        uses: actions/setup-go@v3
        with:
          go-version: '^1.18'

      # apt repos don't have YARA v4.2, install it from git
      - name: Install YARA
        run: |
          git clone --depth 1 https://github.com/virustotal/yara.git
          cd yara
          bash ./build.sh
          sudo make install
          cd ..

      - name: Build
        run: make

      - name: Create release
        uses: ncipollo/release-action@v1
        with:
          artifacts: "php-malware-finder"
          token: ${{ secrets.GITHUB_TOKEN }}
          allowUpdates: true
          omitBody:  true
