name: Create a new GitHub release with the files

on:
  push:
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+'
  workflow_dispatch:

jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
      repository-projects: write
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
      - name: Create a ZIP archive from the fonts directory
        run: zip -r ServerMono-fonts.zip public/fonts
      - name: Create new release and upload artifacts
        uses: ncipollo/release-action@v1
        with:
          artifacts: 'ServerMono-fonts.zip,public/fonts/*'
          artifactErrorsFailBuild: true
          generateReleaseNotes: true
          prerelease: false
          draft: false
