name: Release & Tag

on:
  push:
    tags:
      - 'v*.*.*'

jobs:
  release:
    name: Tag & PHP Compatibility
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Get Version
        id: get_version
        run: |
          VERSION="${GITHUB_REF#refs/tags/v}"
          echo "version=$VERSION" >> "$GITHUB_OUTPUT"
      - name: PHP Compatibility Check
        uses: php-actions/phpcompat@v1
        with:
          php_version: '7.0'
          path: '.'
      - name: Create GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          tag_name: ${{ github.ref }}
          name: Release ${{ steps.get_version.outputs.version }}
          draft: false
          prerelease: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
