on:
  workflow_call:
    inputs:
      tag:
        description: 'Unique tag for the deployment, use commit sha when applicable'
        required: true
        type: string
    outputs:
      version:
        description: "App Vesion"
        value: ${{ jobs.release.outputs.version }}

name: "Release Assemble Web Version"

permissions: write-all

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@v4
    - uses: pnpm/action-setup@v4
      name: Install pnpm
      with:
        run_install: false
    - uses: actions/setup-node@v4
      with:
        node-version: 20
    - name: Install latest corepack
      run: npm i -g corepack@latest
    - name: Setup pnpm
      run: corepack enable pnpm
    - name: Semantic Release
      uses: cycjimmy/semantic-release-action@v4
      id: release
      with:
        extra_plugins: |
          @semantic-release/release-notes-generator
          @semantic-release/changelog
          @semantic-release/commit-analyzer
          @semantic-release/exec
          @semantic-release/git
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
