name: Build & Release VS Code Extension

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

jobs:
  release:
    runs-on: linux

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install dependencies
        run: npm install

      - name: Install vsce
        run: npm install -g @vscode/vsce

      - name: Package Extension
        run: vsce package

      - name: Debug files
        run: ls -lah

      - name: Create Release
        uses: https://gitea.com/actions/gitea-release-action@v1
        with:
          token: ${{ secrets.releasekey }}
          tag_name: ${{ github.ref_name }}
          name: ${{ github.ref_name }}
          files: |-
            *.vsix
          server_url: https://git.cstmgames.dev