diff --git a/.github/actions_scripts/getChangelog.pl b/.github/autobuild/extractVersionChangelog.pl similarity index 100% rename from .github/actions_scripts/getChangelog.pl rename to .github/autobuild/extractVersionChangelog.pl diff --git a/.github/actions_scripts/analyse_git_reference.py b/.github/autobuild/get_build_vars.py similarity index 78% rename from .github/actions_scripts/analyse_git_reference.py rename to .github/autobuild/get_build_vars.py index d093bde21f..f6a5ca55e0 100755 --- a/.github/actions_scripts/analyse_git_reference.py +++ b/.github/autobuild/get_build_vars.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # This script is trigged from the Github Autobuild workflow. # It analyzes Jamulus.pro and git push details (tag vs. branch, etc.) to decide # - whether a release should be created, @@ -32,26 +32,13 @@ 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()) - print("building an intermediate version: ", name) - return name + version = "{}-{}".format(jamulus_pro_version, get_git_hash()) + return 'intermediate', version - name = jamulus_pro_version - print("building a release version: ", name) - return name + version = jamulus_pro_version + return 'release', version def set_github_variable(varname, varval): @@ -60,8 +47,9 @@ def set_github_variable(varname, varval): jamulus_pro_version = get_version_from_jamulus_pro() -write_changelog(jamulus_pro_version) -build_version = get_build_version(jamulus_pro_version) +set_github_variable("JAMULUS_PRO_VERSION", jamulus_pro_version) +build_type, build_version = get_build_version(jamulus_pro_version) +print(f'building a version of type "{build_type}": {build_version}') fullref = os.environ['GITHUB_REF'] publish_to_release = bool(re.match(r'^refs/tags/r\d+_\d+_\d+\S*$', fullref)) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 7cd4c3d1e2..1bf2610eac 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -62,15 +62,21 @@ 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 uses: actions/checkout@v2 - - name: Determine release version, type and prerelease variables and generate Changelog - run: python3 ${{ github.workspace }}/.github/actions_scripts/analyse_git_reference.py + - name: Determine release version, type and prerelease variables + run: ./.github/autobuild/get_build_vars.py id: get-build-vars + - name: Extract Changelog for the Github release body + if: steps.get-build-vars.outputs.PUBLISH_TO_RELEASE == 'true' + run: ./.github/autobuild/extractVersionChangelog.pl ChangeLog ${{ steps.get-build-vars.outputs.JAMULUS_PRO_VERSION }} > ${{ env.release_changelog_path }} + - name: Remove release ${{steps.get-build-vars.outputs.RELEASE_TAG}}, if existing if: steps.get-build-vars.outputs.PUBLISH_TO_RELEASE == 'true' continue-on-error: true @@ -90,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 diff --git a/.gitignore b/.gitignore index 1f49dc501b..b91209eab8 100644 --- a/.gitignore +++ b/.gitignore @@ -45,5 +45,5 @@ distributions/jamulus-server.desktop Debug-iphoneos/ Jamulus.xcodeproj jamulus_plugin_import.cpp -autoLatestChangelog.md +.github_release_changelog.md debian/