diff --git a/.gitea/workflows/build-app-windows.yml b/.gitea/workflows/build-app-windows.yml index 8001ff9..632f527 100644 --- a/.gitea/workflows/build-app-windows.yml +++ b/.gitea/workflows/build-app-windows.yml @@ -16,17 +16,18 @@ jobs: steps: - name: Determine tag id: tag - shell: bash + shell: powershell run: | - TAG="${{ inputs.tag }}" - if [ -z "$TAG" ]; then - TAG="${{ github.event.inputs.tag }}" - fi - if [ -z "$TAG" ]; then - TAG=$(git ls-remote --tags --sort=-v:refname origin 'refs/tags/v*' | head -1 | sed 's|.*refs/tags/||') - fi - echo "Building for tag: ${TAG}" - echo "tag=${TAG}" >> $GITHUB_OUTPUT + $TAG = "${{ inputs.tag }}" + if (-not $TAG) { $TAG = "${{ github.event.inputs.tag }}" } + if (-not $TAG) { + $remote = git ls-remote --tags origin 'refs/tags/v*' 2>$null + if ($remote) { + $TAG = ($remote -split "`n" | Select-Object -Last 1) -replace '.*refs/tags/', '' + } + } + Write-Host "Building for tag: $TAG" + "tag=$TAG" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append - uses: actions/checkout@v4 with: diff --git a/.gitea/workflows/build-sidecar-windows.yml b/.gitea/workflows/build-sidecar-windows.yml index 4c7cf4b..9e3e1b3 100644 --- a/.gitea/workflows/build-sidecar-windows.yml +++ b/.gitea/workflows/build-sidecar-windows.yml @@ -16,17 +16,18 @@ jobs: steps: - name: Determine tag id: tag - shell: bash + shell: powershell run: | - TAG="${{ inputs.tag }}" - if [ -z "$TAG" ]; then - TAG="${{ github.event.inputs.tag }}" - fi - if [ -z "$TAG" ]; then - TAG=$(git ls-remote --tags --sort=-v:refname origin 'refs/tags/sidecar-v*' | head -1 | sed 's|.*refs/tags/||') - fi - echo "Building for tag: ${TAG}" - echo "tag=${TAG}" >> $GITHUB_OUTPUT + $TAG = "${{ inputs.tag }}" + if (-not $TAG) { $TAG = "${{ github.event.inputs.tag }}" } + if (-not $TAG) { + $remote = git ls-remote --tags origin 'refs/tags/sidecar-v*' 2>$null + if ($remote) { + $TAG = ($remote -split "`n" | Select-Object -Last 1) -replace '.*refs/tags/', '' + } + } + Write-Host "Building for tag: $TAG" + "tag=$TAG" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append - uses: actions/checkout@v4 with: