name: "tagged-release"

on:
  push:
    tags:
      - "v*"

jobs:
  tagged-release:
    name: "Tagged Release"
    runs-on: "ubuntu-latest"

    steps:
      - name: Setup Java
        uses: actions/setup-java@v3
        with:
          distribution: 'adopt'
          java-version: '11'
      - name: Clone repository
        uses: GuillaumeFalourd/clone-github-repo-action@main
        with:
          branch: 'master' # fuck this political bullshitshit, took me an hour to fix this
          owner: 'TopchetoEU'
          repository: 'java-jscript'
      - name: "Build"
        run: |
          cd java-jscript; node ./build.js release ${{ github.ref }}

      - uses: "marvinpinto/action-automatic-releases@latest"
        with:
          repo_token: "${{ secrets.GITHUB_TOKEN }}"
          prerelease: false
          files: |
            java-jscript/LICENSE
            java-jscript/dst/*.jar