diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d17b5c0..1502235 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -14,6 +14,8 @@ values = dev prod -[bumpversion:file:./pulp_npm/__init__.py] +[bumpversion:file:./pulp_npm/app/__init__.py] [bumpversion:file:./setup.py] + +[bumpversion:file:./docs/conf.py] diff --git a/.ci/scripts/release_requirements.txt b/.ci/assets/release_requirements.txt similarity index 100% rename from .ci/scripts/release_requirements.txt rename to .ci/assets/release_requirements.txt diff --git a/.ci/scripts/docs-builder.py b/.ci/scripts/docs-builder.py index ef9dd24..6050dca 100644 --- a/.ci/scripts/docs-builder.py +++ b/.ci/scripts/docs-builder.py @@ -90,8 +90,10 @@ def main(): ga_build = False - if not re.search("[a-zA-Z]", branch) and len(branch.split(".")) > 2: + if (not re.search("[a-zA-Z]", branch) or "post" in branch) and len(branch.split(".")) > 2: ga_build = True + if "post" in branch: + branch = ".".join(branch.split(".")[:-1]) # build the docs via the Pulp project itself print("Building the docs") diff --git a/.ci/scripts/release.py b/.ci/scripts/release.py index f61c031..3e85be8 100644 --- a/.ci/scripts/release.py +++ b/.ci/scripts/release.py @@ -69,12 +69,16 @@ def validate_redmine_data(redmine_query_url, redmine_issues): release_path = os.path.dirname(os.path.abspath(__file__)) plugin_path = release_path.split("/.ci")[0] -version = {} plugin_name = "pulp_npm" -with open(f"{plugin_path}/{plugin_name}/__init__.py") as fp: - version_line = [line for line in fp.readlines() if "__version__" in line][0] - exec(version_line, version) -release_version = version["__version__"].replace(".dev", "") +version = None +with open(f"{plugin_path}/setup.py") as fp: + for line in fp.readlines(): + if "version=" in line: + version = line.split('"')[1] + if not version: + raise RuntimeError("Could not detect existing version ... aborting.") +release_version = version.replace(".dev", "") + issues_to_close = [] for filename in Path(f"{plugin_path}/CHANGES").rglob("*"): @@ -155,7 +159,8 @@ def validate_redmine_data(redmine_query_url, redmine_issues): os.system("bump2version release --allow-dirty") -git.add(f"{plugin_path}/{plugin_name}/__init__.py") +git.add(f"{plugin_path}/{plugin_name}/*") +git.add(f"{plugin_path}/docs/conf.py") git.add(f"{plugin_path}/setup.py") git.add(f"{plugin_path}/requirements.txt") git.add(f"{plugin_path}/.bumpversion.cfg") @@ -177,14 +182,17 @@ def validate_redmine_data(redmine_query_url, redmine_issues): os.system(f"bump2version {release_type} --allow-dirty") -version = {} -with open(f"{plugin_path}/{plugin_name}/__init__.py") as fp: - version_line = [line for line in fp.readlines() if "__version__" in line][0] - exec(version_line, version) -new_dev_version = version["__version__"] +new_dev_version = None +with open(f"{plugin_path}/setup.py") as fp: + for line in fp.readlines(): + if "version=" in line: + new_dev_version = line.split('"')[1] + if not new_dev_version: + raise RuntimeError("Could not detect new dev version ... aborting.") -git.add(f"{plugin_path}/{plugin_name}/__init__.py") +git.add(f"{plugin_path}/{plugin_name}/*") +git.add(f"{plugin_path}/docs/conf.py") git.add(f"{plugin_path}/setup.py") git.add(f"{plugin_path}/requirements.txt") git.add(f"{plugin_path}/.bumpversion.cfg") diff --git a/.ci/scripts/secrets.py b/.ci/scripts/secrets.py deleted file mode 100644 index 8e7a773..0000000 --- a/.ci/scripts/secrets.py +++ /dev/null @@ -1,14 +0,0 @@ -import json -import os -import sys - -secrets = json.loads(sys.argv[1]) -for key, value in secrets.items(): - print(f"Setting {key} ...") - lines = len(value.split("\n")) - if lines > 1: - os.system(f"echo '{key}<> $GITHUB_ENV") - os.system(f"echo '{value}' >> $GITHUB_ENV") - os.system("echo 'EOF' >> $GITHUB_ENV") - else: - os.system(f"echo '{key}={value}' >> $GITHUB_ENV") diff --git a/.github/.gitignore b/.github/.gitignore deleted file mode 100644 index 06644f5..0000000 --- a/.github/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Containerfile -settings/ -vars/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9e0d04..7d47d5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,6 +104,12 @@ jobs: run: | .github/workflows/scripts/before_script.sh + - name: Setting secrets + if: github.event_name != 'pull_request' + run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + env: + SECRETS_CONTEXT: ${{ toJson(secrets) }} + - name: Script run: .github/workflows/scripts/script.sh shell: bash diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 19f310d..609e9a7 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -59,6 +59,11 @@ jobs: run: | .github/workflows/scripts/before_script.sh + - name: Setting secrets + run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + env: + SECRETS_CONTEXT: ${{ toJson(secrets) }} + - name: Script run: .github/workflows/scripts/script.sh shell: bash @@ -114,7 +119,7 @@ jobs: run: .github/workflows/scripts/before_script.sh - name: Setting secrets - run: python3 .ci/scripts/secrets.py "$SECRETS_CONTEXT" + run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" env: SECRETS_CONTEXT: ${{ toJson(secrets) }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6e61859..487854b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,6 +58,11 @@ jobs: run: | .github/workflows/scripts/before_script.sh + - name: Setting secrets + run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" + env: + SECRETS_CONTEXT: ${{ toJson(secrets) }} + - name: Script run: .github/workflows/scripts/script.sh shell: bash @@ -114,7 +119,7 @@ jobs: .github/workflows/scripts/before_script.sh - name: Setting secrets - run: python3 .ci/scripts/secrets.py "$SECRETS_CONTEXT" + run: python3 .github/workflows/scripts/secrets.py "$SECRETS_CONTEXT" env: SECRETS_CONTEXT: ${{ toJson(secrets) }} - name: Deploy plugin to pypi diff --git a/.github/workflows/scripts/before_install.sh b/.github/workflows/scripts/before_install.sh index fddc4d3..97c163c 100755 --- a/.github/workflows/scripts/before_install.sh +++ b/.github/workflows/scripts/before_install.sh @@ -67,7 +67,7 @@ fi cd .. -git clone https://github.com/pulp/pulp-openapi-generator.git +git clone --depth=1 https://github.com/pulp/pulp-openapi-generator.git if [ -n "$PULP_OPENAPI_GENERATOR_PR_NUMBER" ]; then cd pulp-openapi-generator git fetch origin pull/$PULP_OPENAPI_GENERATOR_PR_NUMBER/head:$PULP_OPENAPI_GENERATOR_PR_NUMBER @@ -91,24 +91,17 @@ cd .. -# When building a (release) tag, we don't need the development modules for the -# build (they will be installed as dependencies of the plugin). -if [ "${TAG_BUILD}" = "1" ]; then - - git clone --depth=1 https://github.com/pulp/pulp-smash.git - - if [ -n "$PULP_SMASH_PR_NUMBER" ]; then - cd pulp-smash - git fetch --depth=1 origin pull/$PULP_SMASH_PR_NUMBER/head:$PULP_SMASH_PR_NUMBER - git checkout $PULP_SMASH_PR_NUMBER - cd .. - fi - - # pulp-smash already got installed via test_requirements.txt - pip install --upgrade --force-reinstall ./pulp-smash +git clone --depth=1 https://github.com/pulp/pulp-smash.git +if [ -n "$PULP_SMASH_PR_NUMBER" ]; then + cd pulp-smash + git fetch --depth=1 origin pull/$PULP_SMASH_PR_NUMBER/head:$PULP_SMASH_PR_NUMBER + git checkout $PULP_SMASH_PR_NUMBER + cd .. fi +pip install --upgrade --force-reinstall ./pulp-smash + # Intall requirements for ansible playbooks pip install docker netaddr boto3 ansible diff --git a/.github/workflows/scripts/secrets.py b/.github/workflows/scripts/secrets.py new file mode 100644 index 0000000..af5ef74 --- /dev/null +++ b/.github/workflows/scripts/secrets.py @@ -0,0 +1,14 @@ +import json +import os +import sys + +secrets = json.loads(sys.argv[1]) +for key, value in secrets.items(): + print(f"Setting {key} ...") + lines = len(value.split("\n")) + if lines > 1: + os.system(f"/bin/bash -c \"echo '{key}<> $GITHUB_ENV\"") + os.system(f"/bin/bash -c \"echo '{value}' >> $GITHUB_ENV\"") + os.system("/bin/bash -c \"echo 'EOF' >> $GITHUB_ENV\"") + else: + os.system(f"/bin/bash -c \"echo '{key}={value}' >> $GITHUB_ENV\"") diff --git a/docs/conf.py b/docs/conf.py index b0e8e96..ac8d836 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -58,9 +58,9 @@ # built documents. # # The short X.Y version. -version = pulp_npm.__version__ +version = "0.1.0a3.dev" # The full version, including alpha/beta/rc tags. -release = pulp_npm.__version__ +release = "0.1.0a3.dev" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pulp_npm/__init__.py b/pulp_npm/__init__.py index b965ce0..a652781 100644 --- a/pulp_npm/__init__.py +++ b/pulp_npm/__init__.py @@ -1,3 +1 @@ -__version__ = "0.1.0a3.dev" - default_app_config = "pulp_npm.app.PulpNpmPluginAppConfig" diff --git a/pulp_npm/app/__init__.py b/pulp_npm/app/__init__.py index 7267cf8..8a86686 100644 --- a/pulp_npm/app/__init__.py +++ b/pulp_npm/app/__init__.py @@ -6,3 +6,4 @@ class PulpNpmPluginAppConfig(PulpPluginAppConfig): name = "pulp_npm.app" label = "npm" + version = "0.1.0a3.dev"