name: Parse Version Number on: workflow_call: inputs: version: required: true type: string outputs: major: description: "Major number" value: ${{ jobs.parse.outputs.major }} minor: description: "Minor number" value: ${{ jobs.parse.outputs.minor }} patch: description: "Patch number" value: ${{ jobs.parse.outputs.patch }} build: description: "Build number" value: ${{ jobs.parse.outputs.build }} tag: description: "Tag" value: ${{ jobs.parse.outputs.tag }} releaseChannel: description: "The release channel" value: ${{ jobs.parse.outputs.releaseChannel }} simpleVersion: description: "Simple Version output" value: ${{ jobs.parse.outputs.simpleVersion }} buildVersion: description: "Build Version Output" value: ${{ jobs.parse.outputs.buildVersion }} jobs: parse: runs-on: ubuntu-latest outputs: major: ${{ steps.parseStep.outputs.major }} minor: ${{ steps.parseStep.outputs.minor }} patch: ${{ steps.parseStep.outputs.patch }} build: ${{ steps.parseStep.outputs.build }} steps: - id: parseStep run: | tag="${{ inputs.version }}" tag="${tag#refs/tags/}" if [[ "$tag" == *"/"* ]]; then releaseChannel=$(echo "$tag" | cut -d'/' -f1) version=$(echo "$tag" | cut -d'/' -f2) else releaseChannel="beta" version="$tag" fi version=$(echo "$tag" | sed 's|.*/||') IFS='.' read -r major minor patch build <<< "$version" if [ -z "$build" ]; then build="0" fi simpleVersion="$major"."$minor"."$patch"."$build" buildVersion="$major"."$minor"."$patch"-build."$build" echo "major=$major" >> $GITHUB_OUTPUT echo "minor=$minor" >> $GITHUB_OUTPUT echo "patch=$patch" >> $GITHUB_OUTPUT echo "build=$build" >> $GITHUB_OUTPUT echo "tag=$tag" >> $GITHUB_OUTPUT echo "releaseChannel=$releaseChannel" >> $GITHUB_OUTPUT echo "simpleVersion=$simpleVersion" >> $GITHUB_OUTPUT echo "buildVersion=$buildVersion" >> $GITHUB_OUTPUT