Allow the written salt version to be passed to other workflows

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-01-12 12:28:52 +00:00 committed by Pedro Algarvio
parent 4315342238
commit 17b6ebed24
3 changed files with 14 additions and 0 deletions

View file

@ -9,6 +9,10 @@ inputs:
The Salt version to set prior to running tests or building packages.
If not set, it is discover at run time, like, for example, capturing
the output of running `python3 salt/version.py`
outputs:
salt-version:
value: ${{ steps.setup-salt-version.outputs.salt-version }}
description: The Salt version written to `salt/_version.txt`
runs:
using: composite
@ -16,6 +20,7 @@ runs:
steps:
- name: Setup Salt Version
id: setup-salt-version
shell: bash
run: |
tools pkg set-salt-version ${{ inputs.salt-version }}

View file

@ -47,6 +47,7 @@ jobs:
jobs: ${{ steps.process-changed-files.outputs.jobs }}
changed-files: ${{ steps.process-changed-files.outputs.changed-files }}
testrun: ${{ steps.define-testrun.outputs.testrun }}
salt-version: ${{ steps.setup-salt-version.outputs.salt-version }}
steps:
- uses: actions/checkout@v3
- name: Get Changed Files
@ -110,6 +111,7 @@ jobs:
uses: ./.github/actions/setup-python-tools-scripts
- name: Setup Salt Version
id: setup-salt-version
uses: ./.github/actions/setup-salt-version
with:
salt-version: "${{ inputs.salt-version }}"

View file

@ -78,4 +78,11 @@ def set_salt_version(ctx: Context, salt_version: str, overwrite: bool = False):
with open(gh_env_file, "w", encoding="utf-8") as wfh:
wfh.write(f"{variable_text}\n")
gh_output_file = os.environ.get("GITHUB_OUTPUT", None)
if gh_output_file is not None:
variable_text = f"salt-version={salt_version}"
ctx.info(f"Writing '{variable_text}' to '$GITHUB_OUTPUT' file:", gh_output_file)
with open(gh_output_file, "w", encoding="utf-8") as wfh:
wfh.write(f"{variable_text}\n")
ctx.exit(0)