From f8bff954e1ed332cbe6d43a17ce190bc502257fc Mon Sep 17 00:00:00 2001 From: Mariana Prazeres Date: Thu, 3 Dec 2020 10:54:21 +0100 Subject: [PATCH 1/3] Skip publishing changelog for alphas or RCs --- .github/workflows/continous-integration.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 20e44c1e1..8ef44be99 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -162,8 +162,24 @@ jobs: user: __token__ password: ${{ secrets.PYPI_TOKEN }} + - name: Check if tag version is official release + # We need this to avoid attempting to publish changelogs for alphas / rcs + id: rasa_sdk_get_version + if: env.IS_TAG_BUILD == 'true' + env: + GITHUB_TAG: ${{ github.ref }} + run: | + CURRENT_TAG=${GITHUB_TAG/refs\/tags\//} + + # Avoid that the script gets released for alphas or release candidates + if [[ "$CURRENT_TAG" =~ "^[0-9.]+$" ]]; then + echo "::set-output name=is_official_version::true" + else + echo "::set-output name=is_official_version::false" + fi + - name: Publish Release Notes 🗞 - if: env.IS_TAG_BUILD + if: env.IS_TAG_BUILD && steps.rasa_sdk_get_version.outputs.is_official_version == 'true' env: GITHUB_TAG: ${{ github.ref }} GITHUB_REPO_SLUG: ${{ github.repository }} From a036e7f74a3ef6965eebf39d277d0accd18b7f64 Mon Sep 17 00:00:00 2001 From: Mariana Prazeres Date: Thu, 3 Dec 2020 14:44:09 +0100 Subject: [PATCH 2/3] Small fix --- .github/workflows/continous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 8ef44be99..33d59b036 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -172,7 +172,7 @@ jobs: CURRENT_TAG=${GITHUB_TAG/refs\/tags\//} # Avoid that the script gets released for alphas or release candidates - if [[ "$CURRENT_TAG" =~ "^[0-9.]+$" ]]; then + if [[ "$CURRENT_TAG" =~ ^[0-9.]+$ ]]; then echo "::set-output name=is_official_version::true" else echo "::set-output name=is_official_version::false" From d62140222438da22afe83ed7f59b554a42331fcc Mon Sep 17 00:00:00 2001 From: Mariana Prazeres Date: Fri, 4 Dec 2020 12:56:22 +0100 Subject: [PATCH 3/3] Switching to rasa-compliant implem --- .github/workflows/continous-integration.yml | 18 +----------------- scripts/publish_gh_release_notes.py | 7 ++++++- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 33d59b036..20e44c1e1 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -162,24 +162,8 @@ jobs: user: __token__ password: ${{ secrets.PYPI_TOKEN }} - - name: Check if tag version is official release - # We need this to avoid attempting to publish changelogs for alphas / rcs - id: rasa_sdk_get_version - if: env.IS_TAG_BUILD == 'true' - env: - GITHUB_TAG: ${{ github.ref }} - run: | - CURRENT_TAG=${GITHUB_TAG/refs\/tags\//} - - # Avoid that the script gets released for alphas or release candidates - if [[ "$CURRENT_TAG" =~ ^[0-9.]+$ ]]; then - echo "::set-output name=is_official_version::true" - else - echo "::set-output name=is_official_version::false" - fi - - name: Publish Release Notes 🗞 - if: env.IS_TAG_BUILD && steps.rasa_sdk_get_version.outputs.is_official_version == 'true' + if: env.IS_TAG_BUILD env: GITHUB_TAG: ${{ github.ref }} GITHUB_REPO_SLUG: ${{ github.repository }} diff --git a/scripts/publish_gh_release_notes.py b/scripts/publish_gh_release_notes.py index 900082aca..e74276c28 100644 --- a/scripts/publish_gh_release_notes.py +++ b/scripts/publish_gh_release_notes.py @@ -23,6 +23,7 @@ # if this needs any more dependencies, they need to be installed on github deploy stage import github3 +from pep440_version_utils import Version def create_github_release(slug: Text, token: Text, tag_name: Text, body: Text): """Create a github release.""" @@ -75,7 +76,11 @@ def main(): print("GITHUB_REPO_SLUG not set", file=sys.stderr) return 1 - md_body = parse_changelog(tag_name) + version = Version(tag_name) + if version.pre: + md_body = "_Pre-release version_" + else: + md_body = parse_changelog(tag_name) if not md_body: print("Failed to extract changelog entries for version from changelog.")