mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 01:30:20 +00:00
45 lines
1.5 KiB
YAML
45 lines
1.5 KiB
YAML
---
|
|
name: get-python-version
|
|
description: Setup Relenv
|
|
inputs:
|
|
python-binary:
|
|
required: true
|
|
type: string
|
|
description: The python binary to get the version from
|
|
outputs:
|
|
binary:
|
|
value: ${{ steps.get-python-version.outputs.binary }}
|
|
version:
|
|
value: ${{ steps.get-python-version.outputs.version }}
|
|
full-version:
|
|
value: ${{ steps.get-python-version.outputs.full-version }}
|
|
version-sha256sum:
|
|
value: ${{ steps.get-python-version.outputs.version-sha256sum }}
|
|
|
|
|
|
runs:
|
|
using: composite
|
|
|
|
steps:
|
|
|
|
- name: Install System Packages
|
|
if: ${{ runner.os == 'macOS' }}
|
|
shell: bash
|
|
run: |
|
|
brew install coreutils
|
|
|
|
- name: Get Python Version
|
|
id: get-python-version
|
|
shell: bash
|
|
run: |
|
|
echo "Python Binary: ${{ inputs.python-binary }}"
|
|
echo "binary=${{ inputs.python-binary }}" >> "$GITHUB_OUTPUT"
|
|
PY_VERSION=$(${{ inputs.python-binary }} -c "import sys; sys.stdout.write('{}.{}'.format(*sys.version_info))")
|
|
echo "PY_VERSION=$PY_VERSION"
|
|
echo "version=$PY_VERSION" >> "$GITHUB_OUTPUT"
|
|
PY_FULL_VERSION=$(${{ inputs.python-binary }} -c "import sys; sys.stdout.write('{}.{}.{}'.format(*sys.version_info))")
|
|
echo "PY_FULL_VERSION=$PY_FULL_VERSION"
|
|
echo "full-version=$PY_FULL_VERSION" >> "$GITHUB_OUTPUT"
|
|
VERSION_SHA256SUM=$(${{ inputs.python-binary }} --version --version | sha256sum | cut -d ' ' -f 1)
|
|
echo "VERSION_SHA256SUM=$VERSION_SHA256SUM"
|
|
echo "version-sha256sum=$VERSION_SHA256SUM" >> "$GITHUB_OUTPUT"
|