0
0
reusable-workflows/.gitea/workflows/getReleaseChannel.yaml
2025-05-20 09:50:28 +02:00

42 lines
1.3 KiB
YAML

name: Get Release Channel
on:
workflow_call:
inputs:
repo:
required: true
type: string
tag:
required: true
type: string
outputs:
buildChannel:
description: "The current Release Build channel"
value: ${{ jobs.read.outputs.buildChannel }}
jobs:
read:
runs-on: ubuntu-latest
outputs:
buildChannel: ${{ steps.readRelease.outputs.buildChannel }}
steps:
- id: readRelease
run: |
GITEA_API_URL="https://gitea.greyhound-software.com/api/v1"
OWNER="greyhound"
API_TOKEN=${{ vars.PAT_TOKEN }}
### RELEASE ###
# Read Release and Extract the ID
tag=$(echo "${{ inputs.tag }}" | sed 's/\//%2F/g')
release=$(curl -s -H "Authorization: token $API_TOKEN" \
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/releases/tags/$tag")
echo "Release Read $release"
# Extract the string between "Kanal:" and the first double newline "\n\n"
buildChannel=$(echo "$release" | jq -r '.body' | awk -F'Kanal: *' '{if (NF>1) print $2}' | awk -F'\n\n' '{print $1}' | xargs)
echo "Release Channel $buildChannel"
echo "buildChannel=$buildChannel" >> $GITHUB_OUTPUT