1
0
reusable-workflows/.gitea/workflows/parseVersion.yaml

43 lines
1.2 KiB
YAML
Raw Normal View History

2024-10-18 06:46:44 +00:00
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 }}
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: |
2024-10-18 22:42:58 +00:00
VERSION=$(echo ${{ inputs.version }} | sed 's|.*/||')
2024-10-18 06:46:44 +00:00
IFS='.' read -r major minor patch build <<< "$VERSION"
if [ -z "$build" ]; then
build="0"
fi
echo "major=$major" >> $GITHUB_OUTPUT
echo "minor=$minor" >> $GITHUB_OUTPUT
echo "patch=$patch" >> $GITHUB_OUTPUT
echo "build=$build" >> $GITHUB_OUTPUT