Skip to content

Commit

Permalink
add cli version parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
boetro committed Dec 6, 2023
1 parent 4b5ce80 commit 8a1f818
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
5 changes: 5 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ inputs:
description: "The working directory to run the deploy from. Defaults to the root of the repository."
required: false
default: "."
launchflow_cli_version:
description: "The version of the LaunchFlow CLI to use. Defaults to the latest version."
required: false
default: ""
branding:
icon: "cloud"
color: "purple"
Expand All @@ -31,4 +35,5 @@ runs:
INPUT_TO_ENVIRONMENT: ${{ inputs.to_environment_name }}
INPUT_PROJECT_ID: ${{ inputs.project_id }}
INPUT_DKEY: ${{ inputs.deployment_key }}
INPUT_CLI_VERSION: ${{ inputs.launchflow_cli_version }}
shell: bash
15 changes: 6 additions & 9 deletions action/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""GitHub Action for Ruff."""
"""GitHub Action for LaunchFlow Promot."""
import os
import re
import sys
Expand All @@ -9,15 +9,12 @@
TO_ENVIRONMENT = os.environ["INPUT_TO_ENVIRONMENT"]
PROJECT = os.environ["INPUT_PROJECT_ID"]
DKEY = os.environ["INPUT_DKEY"]
CLI_VERSION = os.getenv("INPUT_CLI_VERSION", None)

version_specifier = ""
if VERSION != "":
if not re.match(r"v?\d\.\d{1,3}\.\d{1,3}$", VERSION):
print("VERSION does not match expected pattern")
sys.exit(1)
version_specifier = f"=={VERSION}"

req = f"ruff{version_specifier}"
if CLI_VERSION is not None:
cmd = f"pip install launchflow=={CLI_VERSION}"
else:
cmd = "pip install launchflow"

cmd = "pip install launchflow"
check_call(cmd, shell=True)
Expand Down

0 comments on commit 8a1f818

Please sign in to comment.