From ab23a3bb4c596c59a0b60d1e4ca2c86d48bd0035 Mon Sep 17 00:00:00 2001 From: Igor Bari Date: Sun, 17 Mar 2024 19:31:15 +0000 Subject: [PATCH] use Paths --- scripts/build_test_docker_image.py | 2 +- scripts/pack_test_pages.py | 4 +++- scripts/publish_test_npm_package.py | 2 +- src/github_utils.py | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/build_test_docker_image.py b/scripts/build_test_docker_image.py index 5a40d32..d660d1f 100644 --- a/scripts/build_test_docker_image.py +++ b/scripts/build_test_docker_image.py @@ -13,7 +13,7 @@ secrets = load_vars(sys.argv[2], root_directory / 'vars/vault.yaml') build_and_push_docker_img( - src="src", + src=root_directory / 'src', tag_prefix="docker-image", image_name="publish-tools-test", docker_username=environ.get('GITHUB_REPOSITORY_OWNER'), diff --git a/scripts/pack_test_pages.py b/scripts/pack_test_pages.py index 6841d51..a3f338b 100644 --- a/scripts/pack_test_pages.py +++ b/scripts/pack_test_pages.py @@ -1,7 +1,9 @@ #!/usr/bin/env python3 +from pathlib import Path import init from src.github_utils import create_pages_artifact +root_directory = Path(__file__).parent.parent -create_pages_artifact(directory="test") +create_pages_artifact(directory=root_directory / 'test') diff --git a/scripts/publish_test_npm_package.py b/scripts/publish_test_npm_package.py index b0fa277..fe49591 100644 --- a/scripts/publish_test_npm_package.py +++ b/scripts/publish_test_npm_package.py @@ -13,7 +13,7 @@ secrets = load_vars(sys.argv[2], root_directory / 'vars/vault.yaml') publish_npm_package( - src="src", + src=root_directory / 'src', tag_prefix="npm-package", npm_access_token=secrets['npm_access_token'], github_access_token=sys.argv[1] diff --git a/src/github_utils.py b/src/github_utils.py index fe407d6..33e5d0b 100644 --- a/src/github_utils.py +++ b/src/github_utils.py @@ -1,4 +1,5 @@ import os +from pathlib import Path from random import choice from string import ascii_letters, digits import sys @@ -97,7 +98,7 @@ def upload_release_asset( def create_pages_artifact( *, - directory: str + directory: Path ): random_string = ''.join(choice(ascii_letters + digits) for _ in range(8)) tar_file = f"{environ.get("RUNNER_TEMP")}/{random_string}.tar"