From 0a3db17d484115c99b93950e24b109032b1ea1c9 Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Sat, 18 Jun 2022 16:38:45 +0200 Subject: [PATCH 1/2] Autobuild: Make release changelog generation explicit This was previously done as part of the variable extraction step. It's rather surprising to have a script with the name "analyze*" write to some Changelog file. Therefore, move all of the generation to the same abstraction level (Github workflow). Fixes #2480 --- .github/actions_scripts/analyse_git_reference.py | 13 +------------ .github/workflows/autobuild.yml | 6 +++++- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/actions_scripts/analyse_git_reference.py b/.github/actions_scripts/analyse_git_reference.py index d093bde21f..552d0b879f 100755 --- a/.github/actions_scripts/analyse_git_reference.py +++ b/.github/actions_scripts/analyse_git_reference.py @@ -32,17 +32,6 @@ def get_git_hash(): ]).decode('ascii').strip() -def write_changelog(version): - changelog = subprocess.check_output([ - 'perl', - f'{REPO_PATH}/.github/actions_scripts/getChangelog.pl', - f'{REPO_PATH}/ChangeLog', - version, - ]) - with open(f'{REPO_PATH}/autoLatestChangelog.md', 'wb') as f: - f.write(changelog) - - def get_build_version(jamulus_pro_version): if "dev" in jamulus_pro_version: name = "{}-{}".format(jamulus_pro_version, get_git_hash()) @@ -60,7 +49,7 @@ def set_github_variable(varname, varval): jamulus_pro_version = get_version_from_jamulus_pro() -write_changelog(jamulus_pro_version) +set_github_variable("JAMULUS_PRO_VERSION", jamulus_pro_version) build_version = get_build_version(jamulus_pro_version) fullref = os.environ['GITHUB_REF'] diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 7cd4c3d1e2..df8250e42c 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -67,7 +67,7 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Determine release version, type and prerelease variables and generate Changelog + - name: Determine release version, type and prerelease variables run: python3 ${{ github.workspace }}/.github/actions_scripts/analyse_git_reference.py id: get-build-vars @@ -81,6 +81,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Generate release changelog + if: steps.get-build-vars.outputs.PUBLISH_TO_RELEASE == 'true' + run: ./.github/actions_scripts/getChangelog.pl ./ChangeLog ${{ steps.get-build-vars.outputs.JAMULUS_PRO_VERSION }} > ./autoLatestChangelog.md + - name: Create Release ${{steps.get-build-vars.outputs.RELEASE_TAG}} ${{steps.get-build-vars.outputs.RELEASE_TITLE}} if: steps.get-build-vars.outputs.PUBLISH_TO_RELEASE == 'true' id: create-release From 1a0757256a08c79c987576508336170f8c1eb1fa Mon Sep 17 00:00:00 2001 From: Christian Hoffmann Date: Sat, 18 Jun 2022 16:43:11 +0200 Subject: [PATCH 2/2] Autobuild: Use a variable instead of hardcoding the release changelog path twice Related: #2480 --- .github/workflows/autobuild.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index df8250e42c..2f0fc6d849 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -62,6 +62,8 @@ jobs: publish_to_release: ${{ steps.get-build-vars.outputs.PUBLISH_TO_RELEASE }} upload_url: ${{ steps.create-release.outputs.upload_url }} build_version: ${{ steps.get-build-vars.outputs.BUILD_VERSION }} + env: + release_changelog_path: ./.github_release_changelog.md steps: - name: Checkout code @@ -83,7 +85,7 @@ jobs: - name: Generate release changelog if: steps.get-build-vars.outputs.PUBLISH_TO_RELEASE == 'true' - run: ./.github/actions_scripts/getChangelog.pl ./ChangeLog ${{ steps.get-build-vars.outputs.JAMULUS_PRO_VERSION }} > ./autoLatestChangelog.md + run: ./.github/actions_scripts/getChangelog.pl ./ChangeLog ${{ steps.get-build-vars.outputs.JAMULUS_PRO_VERSION }} > ${{ env.release_changelog_path }} - name: Create Release ${{steps.get-build-vars.outputs.RELEASE_TAG}} ${{steps.get-build-vars.outputs.RELEASE_TITLE}} if: steps.get-build-vars.outputs.PUBLISH_TO_RELEASE == 'true' @@ -94,7 +96,7 @@ jobs: with: tag_name: ${{ steps.get-build-vars.outputs.RELEASE_TAG }} release_name: ${{ steps.get-build-vars.outputs.RELEASE_TITLE }} - body_path: autoLatestChangelog.md + body_path: ${{ env.release_changelog_path }} prerelease: ${{ steps.get-build-vars.outputs.IS_PRERELEASE }} draft: false