Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/actions_scripts/analyse_git_reference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/usr/bin/python3

#
# on a triggered github workflow, this file does the decisions and variagles like
# - shall the build be released (otherwise just run builds to check if there are errors)
# - is it a prerelease
# - title, tag etc of release_tag
#
# see the last lines of the file to see what variables are set
#


import sys
import os

# get the jamulus version from the .pro file
def get_jamulus_version(repo_path_on_disk):
jamulus_version = ""
with open (repo_path_on_disk + '/Jamulus.pro','r') as f:
pro_content = f.read()
pro_content = pro_content.replace('\r','')
pro_lines = pro_content.split('\n')
for line in pro_lines:
line = line.strip()
VERSION_LINE_STARTSWITH = 'VERSION = '
if line.startswith(VERSION_LINE_STARTSWITH):
jamulus_version = line[len(VERSION_LINE_STARTSWITH):]
return jamulus_version
return "UNKNOWN_VERSION"


if len(sys.argv) == 1:
pass
else:
print('wrong number of arguments')
print('Number of arguments:', len(sys.argv), 'arguments.')
print('Argument List:', str(sys.argv))
raise Exception("wrong agruments")

# derive workspace-path
repo_path_on_disk = os.environ['GITHUB_WORKSPACE']

# derive git related variables
release_version_name = get_jamulus_version(repo_path_on_disk)
fullref=os.environ['GITHUB_REF']
reflist = fullref.split("/", 2)
pushed_name = reflist[2]


# run Changelog-script
os.system('perl "{}"/.github/actions_scripts/getChangelog.pl "{}"/ChangeLog "{}" > "{}"/autoLatestChangelog.md'.format(
os.environ['GITHUB_WORKSPACE'],
os.environ['GITHUB_WORKSPACE'],
release_version_name,
os.environ['GITHUB_WORKSPACE']
))

# decisions about release, prerelease, title and tag
if fullref.startswith("refs/tags/"):
print('this reference is a Tag')
release_tag = pushed_name # tag already exists
release_title="Release {} ({})".format(release_version_name, pushed_name)

if pushed_name.startswith("r"):
if "beta" in pushed_name:
print('this reference is a Beta-Release-Tag')
publish_to_release = True
is_prerelease = True
else:
print('this reference is a Release-Tag')
publish_to_release = True
is_prerelease = False
else:
print('this reference is a Non-Release-Tag')
publish_to_release = False
is_prerelease = True # just in case

if pushed_name == "latest":
print('this reference is a Latest-Tag')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the latest release a prerelease?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didnt care there, I thought the idea of this tag had died.

GitHub has a „latest release“ feature anyway.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d there an URL which is always accessible and pointing to the latest release? I think @corrados said somewhere that probably many people use this somehow. I also think that a url which always points to the latest release is needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look at this:
https://github.com/nefarius2001/jamulus/releases/latest

It points to the release with the youngest creation time, and is not related to the "latest" tag. I'd prefer that, since then the files also keep their version in name. But whoever actually does the releases, has the last word on how they should be done.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I didn't know about this feature.

since then the files also keep their version in name

I would like to have a steady link which we could link on the jamulus.io page as (second) mirror.
The user would then click on "Download Jamulus" and the download would then start right away without leaving jamulus.io

This would provide a better user experience since they wouldn't be redirected to sourceforge which some people dislike (there are issues on that here).

The binaries would still be uploaded to SourceForge and maybe even linked on jamulus.io so that we have multiple mirrors. Multiple mirrors provide redundancy and also higher availability. If one is down, there is still the other one.

publish_to_release = True
is_prerelease = False
release_version_name = "latest"
release_title='Release "latest"'
elif fullref.startswith("refs/heads/"):
print('this reference is a Head/Branch')
publish_to_release = False
is_prerelease = True
release_title='Pre-Release of "{}"'.format(pushed_name)
release_tag = "releasetag/"+pushed_name #better not use pure pushed name, creates a tag with the name of the branch, leads to ambiguous references => can not push to this branch easily
else:
print('unknown git-reference type: ' + fullref)
publish_to_release = False
is_prerelease = True
release_title='Pre-Release of "{}"'.format(pushed_name)
release_tag = "releasetag/"+pushed_name #avoid ambiguity in references in all cases

#helper function: set github variable and print it to console
def set_github_variable(varname, varval):
print("{}='{}'".format(varname, varval)) #console output
print("::set-output name={}::{}".format(varname, varval))

#set github-available variables
set_github_variable("PUBLISH_TO_RELEASE", str(publish_to_release).lower())
set_github_variable("IS_PRERELEASE", str(is_prerelease).lower())
set_github_variable("RELEASE_TITLE", release_title)
set_github_variable("RELEASE_TAG", release_tag)
set_github_variable("PUSHED_NAME", pushed_name)
set_github_variable("JAMULUS_VERSION", release_version_name)
set_github_variable("RELEASE_VERSION_NAME", release_version_name)
7 changes: 0 additions & 7 deletions .github/actions_scripts/get_release_vars.sh

This file was deleted.

204 changes: 108 additions & 96 deletions .github/workflows/autobuild.yml
Original file line number Diff line number Diff line change
@@ -1,110 +1,125 @@
#### Automatically build and upload releases to GitHub ####

on:
workflow_dispatch:
push:
tags:
- "r*" # run this action if a tag beginning with r is created
workflow_dispatch:

- "r*"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- "r*"
- "r*"
- "latest"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added latest as trigger
decide yourself if you want to use the "latest" tag or leave that code unused/triggered

- "latest"
#branches:
# - "*"
# - master
# - *autobuild*
name: Publish Release
jobs:

## Creates the releases on GitHub ##
create_release:
name: Create release
runs-on: ubuntu-latest
outputs: # The outputs the following steps give back are sent to the other job
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload_latest_url: ${{ steps.create_latest_release.outputs.upload_url }}
outputs:
publish_to_release: ${{ steps.jamulus-build-vars.outputs.PUBLISH_TO_RELEASE }}
upload_url: ${{ steps.create_release_step.outputs.upload_url }}
version: ${{ steps.jamulus-build-vars.outputs.JAMULUS_VERSION }}
version_name: ${{ steps.jamulus-build-vars.outputs.RELEASE_VERSION_NAME }}

steps:
# Checkout code
- name: Checkout code
uses: actions/checkout@v2
- name: Get Jamulus build info # Gets Changelog and version of this build
run: sh ${{ github.workspace }}/.github/actions_scripts/get_release_vars.sh ${{ github.workspace }}

# Set variables
# Determine release / pre-release
- name: Get Jamulus build info, determine actions & variables
run: python3 ${{ github.workspace }}/.github/actions_scripts/analyse_git_reference.py
id: jamulus-build-vars
- name: Remove latest tag # removes the "latest" tag from the last version

# remove release, if it exists (with this releasetag)
- name: Remove release, if existing (for latest and branches)
if: ${{ contains(steps.jamulus-build-vars.outputs.PUBLISH_TO_RELEASE, 'true') }}
continue-on-error: true
uses: dev-drprasad/delete-tag-and-release@v0.1.2
with:
delete_release: true
tag_name: latest # tag name to delete
delete_release: false
tag_name: ${{ steps.jamulus-build-vars.outputs.RELEASE_TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Actually create the release on GitHub
- name: Prepare latest release # create a release tagged latest
id: create_latest_release
# create release (empty, filled by next jobs)
- name: 'Create Release ${{steps.jamulus-build-vars.outputs.RELEASE_TAG}} {{steps.jamulus-build-vars.outputs.RELEASE_TITLE}}'
if: ${{ contains(steps.jamulus-build-vars.outputs.PUBLISH_TO_RELEASE, 'true') }}
id: create_release_step
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: latest
release_name: Latest release ${{ steps.jamulus-build-vars.outputs.JAMULUS_VERSION }} (auto build)
tag_name: ${{ steps.jamulus-build-vars.outputs.RELEASE_TAG }}
release_name: ${{ steps.jamulus-build-vars.outputs.RELEASE_TITLE }}
body_path: ${{ github.workspace }}/autoLatestChangelog.md
prerelease: ${{ steps.jamulus-build-vars.outputs.IS_PRERELEASE }}
draft: false
prerelease: false

- name: Prepare tag release # creates a release with the tag which triggered this action
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.jamulus-build-vars.outputs.PUSH_TAG }}
release_name: Release ${{ steps.jamulus-build-vars.outputs.JAMULUS_VERSION }} (auto build)
body_path: ${{ github.workspace }}/autoLatestChangelog.md
draft: false
prerelease: false

## Builds and uploads the binaries ##
### CANCEL ### can be used for development concerning release-creation
#- name: Cancelthrougherroe
# run: myundefinedfunction


release_assets:
name: Release assets
name: Build assets for ${{ matrix.config.config_name }}
needs: create_release
runs-on: ${{ matrix.config.os }}
runs-on: ${{ matrix.config.building_on_os }}
strategy:
fail-fast: false
matrix: # Think of this like a foreach loop. Basically runs the steps with every combination of the contents of this. More info: https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
config:
- os: ubuntu-18.04
- config_name: Linux (normal)
target_os: linux
building_on_os: ubuntu-18.04
asset_path: deploy/Jamulus_amd64.deb
asset_name: jamulus_${{ needs.create_release.outputs.version }}_ubuntu_amd64.deb
asset_latest_name: jamulus_latest_ubuntu_amd64.deb
asset_path_two: deploy/Jamulus_headless_amd64.deb
asset_name_two: jamulus_headless_${{ needs.create_release.outputs.version }}_ubuntu_amd64.deb
asset_latest_name_two: jamulus_headless_ubuntu_amd64.deb
- os: macos-10.15
asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_ubuntu_amd64.deb
- config_name: Linux (headless)
target_os: linux
building_on_os: ubuntu-18.04
asset_path: deploy/Jamulus_headless_amd64.deb
asset_name: jamulus_headless_${{ needs.create_release.outputs.version_name }}_ubuntu_amd64.deb
- config_name: MacOS
target_os: macos
building_on_os: macos-10.15
asset_path: deploy/Jamulus-installer-mac.dmg
asset_name: jamulus_${{ needs.create_release.outputs.version }}_mac.dmg
asset_latest_name: jamulus_latest_mac.dmg
- os: windows-latest
asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_mac.dmg
- config_name: Windows
target_os: windows
building_on_os: windows-latest
asset_path: deploy\Jamulus-installer-win.exe
asset_latest_name: jamulus_latest_win.exe
asset_name: jamulus_${{ needs.create_release.outputs.version }}_win.exe

asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_win.exe
- config_name: AndroidAPK
target_os: android
building_on_os: ubuntu-18.04
asset_path: android-build/build/outputs/apk/debug/android-build-debug.apk
asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_android.apk
steps:

### Setup ###

# Get the code
# Checkout code
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

### Build ###

# Build
- name: "Build deb (Linux)"
run: sh linux/autorelease_linux.sh ${{ github.workspace }}
if: matrix.config.os == 'ubuntu-18.04'
if: matrix.config.target_os == 'linux'
- name: "Build (Windows)"
run: powershell .\windows\autorelease_windows.ps1 -sourcepath "${{ github.workspace }}"
if: matrix.config.os == 'windows-latest'
if: matrix.config.target_os == 'windows'
- name: "Build (macOS)"
run: sh mac/autorelease_mac.sh ${{ github.workspace }}
if: matrix.config.os == 'macos-10.15'

### Upload releases ###

## Upload assets to the release which is tagged with the tag that triggered this action.
- name: Upload Release Asset 1
if: matrix.config.target_os == 'macos'
- name: "Build (Android)"
uses: ./android/automated_build/ # Uses an action in the directory
if: matrix.config.target_os == 'android'

# Upload release
- name: Upload Release Asset - Tag
if: ${{ contains(needs.create_release.outputs.publish_to_release, 'true') }}
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
Expand All @@ -114,39 +129,36 @@ jobs:
asset_path: ${{ matrix.config.asset_path }}
asset_name: ${{ matrix.config.asset_name }}
asset_content_type: application/octet-stream

# There might be two assets (at least for Debian)
- name: Upload Release Asset 2
if: matrix.config.asset_name_two != null
id: upload-release-asset-two
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ matrix.config.asset_path_two }}
asset_name: ${{ matrix.config.asset_name_two }}
asset_content_type: application/octet-stream

## Upload assets latest release
- name: Upload latest Release Asset 1
id: upload-latest-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_latest_url }} # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ matrix.config.asset_path }}
asset_name: ${{ matrix.config.asset_latest_name }}
asset_content_type: application/octet-stream
- name: Upload latest Release Asset 2
if: matrix.config.asset_latest_name_two != null
id: upload-latest-release-asset-two
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_latest_url }}
asset_path: ${{ matrix.config.asset_path_two }}
asset_name: ${{ matrix.config.asset_latest_name_two }}
asset_content_type: application/octet-stream

## Builds a Linux flatpack ##
flatpak-builder:
name: "Flatpak Builder"
runs-on: ubuntu-latest
needs: [create_release]
container:
image: docker.io/bilelmoussaoui/flatpak-github-actions
options: --privileged
steps:
- uses: actions/checkout@v2
- name: Change branch name in manifest
run: python3 io.jamulus.Jamulus.prepare.py $GITHUB_SHA
working-directory: ./distributions/
- uses: bilelmoussaoui/flatpak-github-actions@v2
with:
bundle: "io.jamulus.Jamulus.flatpak"
manifest-path: "distributions/io.jamulus.Jamulus.json"
- uses: actions/download-artifact@v2
with:
name: io.jamulus.Jamulus
path: ~/io.jamulus.Jamulus
Comment thread
nefarius2001 marked this conversation as resolved.
- name: Upload Flatpack
if: ${{ contains(needs.create_release.outputs.publish_to_release, 'true') }}
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }} # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: /github/home/io.jamulus.Jamulus/io.jamulus.Jamulus.flatpak
asset_name: io.jamulus.Jamulus.flatpak
asset_content_type: application/octet-stream
19 changes: 0 additions & 19 deletions .github/workflows/autobuild_flatpak.yml

This file was deleted.

Loading