on:
  workflow_call:
    outputs:
      version:
        description: "App Version"
        value: ${{ jobs.release.outputs.version }}

name: "Release Record Web Version"

permissions:
  contents: write
  issues: write
  pull-requests: write
  id-token: write

jobs:
  release:
    runs-on: [self-hosted, linux, x64, ubuntu]
    name: Release
    outputs:
      version: ${{ steps.release.outputs.new_release_version }}
    steps:
    - name: Checkout
      uses: actions/checkout@v6
      with:
        fetch-depth: 0
    - uses: actions/setup-node@v6
      with:
        node-version-file: '.nvmrc'
    - name: Enable Corepack
      run: corepack enable
    - name: Prepare pnpm
      run: corepack install
    - name: Semantic Release
      uses: cycjimmy/semantic-release-action@v4
      id: release
      with:
        extra_plugins: |
          @semantic-release/release-notes-generator
          @semantic-release/commit-analyzer
          @semantic-release/exec
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
