From ccba31799ab92a6b86ec8dd202b737cef541ec59 Mon Sep 17 00:00:00 2001 From: Giovanni M Guidini <99758426+giovanni-guidini@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:19:55 -0300 Subject: [PATCH] chore: New release process (#274) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This proposed release process is heavily inspired in the worker self-hosted release. My beef with the current release process is having to create a PR that updates the version number, AND then manually creating a release. This proposed workflow will have you manually trigger the `create_release_pr` action with the version number you want. That will create a PR for you that you can merge yourself. This PR will then trigger a new release to be created, and the release assets will be generated from that. THe VERSION file is so we can re-use the existing "create PR" workflow as is. Thanks @trent-codecov for the updated, reusable workflows ❤️ --- .github/workflows/create_release.yml | 14 ++++++++++++++ .github/workflows/create_release_pr.yml | 14 ++++++++++++++ VERSION | 1 + codecov_cli/__init__.py | 5 ++++- setup.py | 4 ++-- 5 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/create_release.yml create mode 100644 .github/workflows/create_release_pr.yml create mode 100644 VERSION diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml new file mode 100644 index 00000000..604c1f3f --- /dev/null +++ b/.github/workflows/create_release.yml @@ -0,0 +1,14 @@ +name: Create CLI Release + +on: + pull_request: + branches: + - main + types: [closed] + +jobs: + create-release: + name: Tag Release ${{ github.head_ref }} + if: ${{ github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') && github.repository_owner == 'codecov' }} + uses: codecov/gha-workflows/.github/workflows/create-release.yml@v1.1.0 + secrets: inherit diff --git a/.github/workflows/create_release_pr.yml b/.github/workflows/create_release_pr.yml new file mode 100644 index 00000000..5c57f350 --- /dev/null +++ b/.github/workflows/create_release_pr.yml @@ -0,0 +1,14 @@ +name: Create CLI Release PR + +on: + workflow_dispatch: + inputs: + versionName: + description: 'Name of version (ie 23.9.5)' + required: true + +jobs: + create-release-pr: + name: Create PR for Release ${{ github.event.inputs.versionName }} + uses: codecov/gha-workflows/.github/workflows/create-release-pr.yml@v1.1.0 + secrets: inherit \ No newline at end of file diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..87a08711 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.3.3 \ No newline at end of file diff --git a/codecov_cli/__init__.py b/codecov_cli/__init__.py index e19434e2..17340198 100644 --- a/codecov_cli/__init__.py +++ b/codecov_cli/__init__.py @@ -1 +1,4 @@ -__version__ = "0.3.3" +with open("VERSION", encoding="utf-8") as f: + version_number = f.readline().strip() + +__version__ = version_number diff --git a/setup.py b/setup.py index e66e5d7b..02b2b29f 100644 --- a/setup.py +++ b/setup.py @@ -8,8 +8,8 @@ with open(path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read() -with open(path.join(here, "codecov_cli/__init__.py"), encoding="utf-8") as f: - version = f.read().split('"')[1] +with open(path.join(here, "VERSION"), encoding="utf-8") as f: + version = f.readline().strip() setup( name="codecov-cli",