From 08c33c3f097e08e66993e815c904100a70090f41 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 14 Jun 2023 11:45:30 -0700 Subject: [PATCH] Update GH automation to best practices --- .github/workflows/license_tests.yml | 3 +-- .github/workflows/propose_release.yml | 27 ++++++++++++++++++++++++ .github/workflows/publish_test_build.yml | 1 + .github/workflows/pull_master.yml | 14 ------------ setup.py | 10 ++++----- 5 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/propose_release.yml delete mode 100644 .github/workflows/pull_master.yml diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml index a284db6..4af3f07 100644 --- a/.github/workflows/license_tests.yml +++ b/.github/workflows/license_tests.yml @@ -1,8 +1,7 @@ name: Run License Tests on: - push: workflow_dispatch: - + pull_request: jobs: license_tests: uses: neongeckocom/.github/.github/workflows/license_tests.yml@master diff --git a/.github/workflows/propose_release.yml b/.github/workflows/propose_release.yml new file mode 100644 index 0000000..81dfe43 --- /dev/null +++ b/.github/workflows/propose_release.yml @@ -0,0 +1,27 @@ +name: Propose Stable Release +on: + workflow_dispatch: + inputs: + release_type: + type: choice + description: Release Type + options: + - patch + - minor + - major +jobs: + update_version: + uses: neongeckocom/.github/.github/workflows/propose_semver_release.yml@master + with: + branch: dev + release_type: ${{ inputs.release_type }} + update_changelog: True + pull_changes: + uses: neongeckocom/.github/.github/workflows/pull_master.yml@master + needs: update_version + with: + pr_reviewer: neonreviewers + pr_assignee: ${{ github.actor }} + pr_draft: false + pr_title: ${{ needs.update_version.outputs.version }} + pr_body: ${{ needs.update_version.outputs.changelog }} \ No newline at end of file diff --git a/.github/workflows/publish_test_build.yml b/.github/workflows/publish_test_build.yml index 249a235..48d6f0e 100644 --- a/.github/workflows/publish_test_build.yml +++ b/.github/workflows/publish_test_build.yml @@ -14,3 +14,4 @@ jobs: secrets: inherit with: version_file: "version.py" + publish_prerelease: true diff --git a/.github/workflows/pull_master.yml b/.github/workflows/pull_master.yml deleted file mode 100644 index c3a54b7..0000000 --- a/.github/workflows/pull_master.yml +++ /dev/null @@ -1,14 +0,0 @@ -# This workflow will generate a PR for changes in dev into master - -name: Pull to Master -on: - push: - branches: - - dev - -jobs: - pull_changes: - uses: neongeckocom/.github/.github/workflows/pull_master.yml@master - with: - pr_reviewer: neonreviewers - pr_assignee: neondaniel diff --git a/setup.py b/setup.py index 8589ebb..5b47889 100644 --- a/setup.py +++ b/setup.py @@ -33,11 +33,11 @@ SKILL_PKG = SKILL_NAME.replace('-', '_') # skill_id=package_name:SkillClass PLUGIN_ENTRY_POINT = f'{SKILL_NAME}.neongeckocom={SKILL_PKG}:LauncherSkill' +BASE_PATH = path.abspath(path.dirname(__file__)) def get_requirements(requirements_filename: str): - requirements_file = path.join(path.abspath(path.dirname(__file__)), - requirements_filename) + requirements_file = path.join(BASE_PATH, requirements_filename) with open(requirements_file, 'r', encoding='utf-8') as r: requirements = r.readlines() requirements = [r.strip() for r in requirements if r.strip() @@ -59,7 +59,7 @@ def get_requirements(requirements_filename: str): def find_resource_files(): resource_base_dirs = ("locale", "ui", "vocab", "dialog", "regex") - base_dir = path.dirname(__file__) + base_dir = BASE_PATH package_data = ["skill.json"] for res in resource_base_dirs: if path.isdir(path.join(base_dir, res)): @@ -72,10 +72,10 @@ def find_resource_files(): return package_data -with open("README.md", "r") as f: +with open(path.join(BASE_PATH, "README.md"), "r") as f: long_description = f.read() -with open("./version.py", "r", encoding="utf-8") as v: +with open(path.join(BASE_PATH, "version.py"), "r", encoding="utf-8") as v: for line in v.readlines(): if line.startswith("__version__"): if '"' in line: