mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	Pre-Release detection on Azure
This commit is contained in:
		
							
								
								
									
										64
									
								
								.azure.yml
									
									
									
									
									
								
							
							
						
						
									
										64
									
								
								.azure.yml
									
									
									
									
									
								
							@@ -35,6 +35,14 @@ jobs:
 | 
			
		||||
  - checkout: self # represents the repo where the initial Pipelines YAML file was found
 | 
			
		||||
    submodules: recursive # set to 'recursive' to get submodules of submodules
 | 
			
		||||
 | 
			
		||||
  # read channel tag in version.json
 | 
			
		||||
  - task: oneLuckiDevJson2Variable@1
 | 
			
		||||
    inputs:
 | 
			
		||||
      jsonFile: 'version.json'
 | 
			
		||||
      shouldPrefixVariables: true
 | 
			
		||||
      variablePrefix: 'json'
 | 
			
		||||
    displayName: 'Read and generate pipeline variables'
 | 
			
		||||
 | 
			
		||||
  # build process
 | 
			
		||||
  - bash: ./.ci/ci_build.sh
 | 
			
		||||
    displayName: 'Build $(dockerName)'
 | 
			
		||||
@@ -43,15 +51,6 @@ jobs:
 | 
			
		||||
      DOCKER_NAME: $(dockerName)
 | 
			
		||||
      PLATFORM: $(platform)
 | 
			
		||||
 | 
			
		||||
  # read version.json and generate pipeline variables
 | 
			
		||||
  - task: oneLuckiDevJson2Variable@1
 | 
			
		||||
    inputs:
 | 
			
		||||
      jsonFile: 'version.json'
 | 
			
		||||
      shouldPrefixVariables: true
 | 
			
		||||
      variablePrefix: 'json'
 | 
			
		||||
    condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
 | 
			
		||||
    displayName: 'Read and generate pipeline variables'
 | 
			
		||||
 | 
			
		||||
  # copy files
 | 
			
		||||
  - bash: 'cp -v deploy/Hyperion.NG-* $(Build.ArtifactStagingDirectory)'
 | 
			
		||||
    workingDirectory: '$(Build.SourcesDirectory)'
 | 
			
		||||
@@ -66,10 +65,10 @@ jobs:
 | 
			
		||||
    condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
 | 
			
		||||
    displayName: 'Publish deployables artifacts'
 | 
			
		||||
 | 
			
		||||
  # assign latest tag variable
 | 
			
		||||
  - bash: echo "##vso[task.setvariable variable=latestTag]$(git tag | tail -1)"
 | 
			
		||||
    displayName: "Read latest tag"
 | 
			
		||||
    condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
 | 
			
		||||
  # set release to pre-release
 | 
			
		||||
  - bash: echo '##vso[task.setvariable variable=preRelease;]true'
 | 
			
		||||
    condition: and(succeeded(), contains(variables['json.channel'], 'beta'), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
 | 
			
		||||
    displayName: 'Mark beta as pre-release'
 | 
			
		||||
 | 
			
		||||
  # create or update github release
 | 
			
		||||
  - task: GithubRelease@0
 | 
			
		||||
@@ -79,14 +78,11 @@ jobs:
 | 
			
		||||
      action: edit
 | 
			
		||||
      target: $(Build.SourceVersion)
 | 
			
		||||
      tagSource: manual
 | 
			
		||||
      tag: '$(latestTag)'
 | 
			
		||||
      title: '# $(latestTag) v$(json.versionnr)'
 | 
			
		||||
      releaseNotesSource: input
 | 
			
		||||
      releaseNotes: $(Build.SourceVersionMessage)
 | 
			
		||||
      tag: $(Build.SourceBranchName)
 | 
			
		||||
      assets: '$(Build.ArtifactStagingDirectory)/*'
 | 
			
		||||
      assetUploadMode: 'replace'
 | 
			
		||||
      isPreRelease: true
 | 
			
		||||
      addChangeLog: false
 | 
			
		||||
      isPreRelease: $(preRelease)
 | 
			
		||||
    condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
 | 
			
		||||
    displayName: Create/Update GitHub release
 | 
			
		||||
 | 
			
		||||
@@ -103,6 +99,14 @@ jobs:
 | 
			
		||||
  - checkout: self # represents the repo where the initial Pipelines YAML file was found
 | 
			
		||||
    submodules: recursive # set to 'recursive' to get submodules of submodules
 | 
			
		||||
 | 
			
		||||
  # read channel tag in version.json
 | 
			
		||||
  - task: oneLuckiDevJson2Variable@1
 | 
			
		||||
    inputs:
 | 
			
		||||
      jsonFile: 'version.json'
 | 
			
		||||
      shouldPrefixVariables: true
 | 
			
		||||
      variablePrefix: 'json'
 | 
			
		||||
    displayName: 'Read and generate pipeline variables'
 | 
			
		||||
 | 
			
		||||
  # install dependencies
 | 
			
		||||
  - bash: ./.ci/ci_install.sh
 | 
			
		||||
    displayName: 'Install dependencies'
 | 
			
		||||
@@ -111,15 +115,6 @@ jobs:
 | 
			
		||||
  - bash: ./.ci/ci_build.sh
 | 
			
		||||
    displayName: 'Build macOS 10.13'
 | 
			
		||||
 | 
			
		||||
  # read version.json and generate pipeline variables
 | 
			
		||||
  - task: oneLuckiDevJson2Variable@1
 | 
			
		||||
    inputs:
 | 
			
		||||
      jsonFile: 'version.json'
 | 
			
		||||
      shouldPrefixVariables: true
 | 
			
		||||
      variablePrefix: 'json'
 | 
			
		||||
    condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
 | 
			
		||||
    displayName: 'Read and generate pipeline variables'
 | 
			
		||||
 | 
			
		||||
  # copy files
 | 
			
		||||
  - bash: 'cp -v build/Hyperion.NG-* $(Build.ArtifactStagingDirectory)'
 | 
			
		||||
    workingDirectory: '$(Build.SourcesDirectory)'
 | 
			
		||||
@@ -134,10 +129,10 @@ jobs:
 | 
			
		||||
    condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
 | 
			
		||||
    displayName: 'Publish deployables artifacts'
 | 
			
		||||
 | 
			
		||||
  # generate latest tag variable
 | 
			
		||||
  - bash: echo "##vso[task.setvariable variable=latestTag]$(git tag | tail -1)"
 | 
			
		||||
    displayName: "Read latest tag"
 | 
			
		||||
    condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
 | 
			
		||||
  # set release to pre-release
 | 
			
		||||
  - bash: echo '##vso[task.setvariable variable=preRelease;]true'
 | 
			
		||||
    condition: and(succeeded(), contains(variables['json.channel'], 'beta'), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
 | 
			
		||||
    displayName: 'Mark beta as pre-release'
 | 
			
		||||
 | 
			
		||||
  # create or update github release
 | 
			
		||||
  - task: GithubRelease@0
 | 
			
		||||
@@ -147,13 +142,10 @@ jobs:
 | 
			
		||||
      action: edit
 | 
			
		||||
      target: $(Build.SourceVersion)
 | 
			
		||||
      tagSource: manual
 | 
			
		||||
      tag: '$(latestTag)'
 | 
			
		||||
      title: '# $(latestTag) v$(json.versionnr)'
 | 
			
		||||
      releaseNotesSource: input
 | 
			
		||||
      releaseNotes: $(Build.SourceVersionMessage)
 | 
			
		||||
      tag: '$(Build.SourceBranchName)'
 | 
			
		||||
      assets: '$(Build.ArtifactStagingDirectory)/*'
 | 
			
		||||
      assetUploadMode: 'replace'
 | 
			
		||||
      isPreRelease: true
 | 
			
		||||
      addChangeLog: false
 | 
			
		||||
      isPreRelease: $(preRelease)
 | 
			
		||||
    condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
 | 
			
		||||
    displayName: Create/Update GitHub release
 | 
			
		||||
 
 | 
			
		||||
@@ -25,20 +25,28 @@ EXECUTE_PROCESS (
 | 
			
		||||
	OUTPUT_VARIABLE RETURN_VERSION
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
SET(VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?")
 | 
			
		||||
IF( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
 | 
			
		||||
	STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${RETURN_VERSION})
 | 
			
		||||
	LIST(GET VERSION_PARTS 0 VERSION_MAJOR)
 | 
			
		||||
	LIST(GET VERSION_PARTS 1 VERSION_MINOR)
 | 
			
		||||
	LIST(GET VERSION_PARTS 2 VERSION_PATCH)
 | 
			
		||||
SET( VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?" )
 | 
			
		||||
IF( ${RETURN_VERSION} MATCHES ${VERSION_REGEX})
 | 
			
		||||
	STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${RETURN_VERSION} )
 | 
			
		||||
	LIST( GET VERSION_PARTS 0 VERSION_MAJOR )
 | 
			
		||||
	LIST( GET VERSION_PARTS 1 VERSION_MINOR )
 | 
			
		||||
	LIST( GET VERSION_PARTS 2 VERSION_PATCH )
 | 
			
		||||
ELSE( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
 | 
			
		||||
	message( FATAL_ERROR "Failed to parse version.json string properly. Expect X.Y.Z.")
 | 
			
		||||
ENDIF()
 | 
			
		||||
 | 
			
		||||
SET ( HYPERION_VERSION_STABLE OFF )
 | 
			
		||||
SET ( HYPERION_VERSION_MAJOR ${VERSION_MAJOR} )
 | 
			
		||||
SET ( HYPERION_VERSION_MINOR ${VERSION_MINOR} )
 | 
			
		||||
SET ( HYPERION_VERSION_PATCH ${VERSION_PATCH} )
 | 
			
		||||
SET( HYPERION_VERSION_MAJOR ${VERSION_MAJOR} )
 | 
			
		||||
SET( HYPERION_VERSION_MINOR ${VERSION_MINOR} )
 | 
			
		||||
SET( HYPERION_VERSION_PATCH ${VERSION_PATCH} )
 | 
			
		||||
 | 
			
		||||
# Read channel from version.json
 | 
			
		||||
EXECUTE_PROCESS (
 | 
			
		||||
	COMMAND python test/jsonchecks/version.py ${PROJECT_SOURCE_DIR}/version.json "channel"
 | 
			
		||||
	WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
 | 
			
		||||
	OUTPUT_VARIABLE RETURN_CHANNEL
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
SET ( HYPERION_VERSION_CHANNEL ${RETURN_CHANNEL} )
 | 
			
		||||
 | 
			
		||||
# Set build variables
 | 
			
		||||
SET ( DEFAULT_AMLOGIC    OFF )
 | 
			
		||||
 
 | 
			
		||||
@@ -42,6 +42,6 @@
 | 
			
		||||
#define HYPERION_VERSION_MAJOR "${HYPERION_VERSION_MAJOR}"
 | 
			
		||||
#define HYPERION_VERSION_MINOR "${HYPERION_VERSION_MINOR}"
 | 
			
		||||
#define HYPERION_VERSION_PATCH "${HYPERION_VERSION_PATCH}"
 | 
			
		||||
#define HYPERION_VERSION       "${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}"
 | 
			
		||||
#define HYPERION_VERSION       "${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}"
 | 
			
		||||
 | 
			
		||||
#define HYPERION_JSON_VERSION "1.0.0"
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,5 @@ STRING ( STRIP "${BUILD_ID}" BUILD_ID )
 | 
			
		||||
STRING ( STRIP "${VERSION_ID}" VERSION_ID )
 | 
			
		||||
STRING ( STRIP "${GIT_REMOTE_PATH}" GIT_REMOTE_PATH )
 | 
			
		||||
SET ( HYPERION_BUILD_ID "${VERSION_ID} (${BUILD_ID}) Git Remote: ${GIT_REMOTE_PATH}" )
 | 
			
		||||
message ( STATUS "Current Version: ${HYPERION_BUILD_ID}" )
 | 
			
		||||
SET ( HYPERION_VERSION "${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}" )
 | 
			
		||||
message ( STATUS "Current Version: ${HYPERION_VERSION} (${HYPERION_BUILD_ID})" )
 | 
			
		||||
 
 | 
			
		||||
@@ -29,9 +29,9 @@ SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hyperion is an open source ambient ligh
 | 
			
		||||
SET ( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md" )
 | 
			
		||||
 | 
			
		||||
if ( NOT DEFINED DOCKER_PLATFORM )
 | 
			
		||||
	SET ( CPACK_PACKAGE_FILE_NAME "Hyperion.NG-${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}")
 | 
			
		||||
	SET ( CPACK_PACKAGE_FILE_NAME "Hyperion.NG-${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}")
 | 
			
		||||
else()
 | 
			
		||||
	SET ( CPACK_PACKAGE_FILE_NAME "Hyperion.NG-${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}-${DOCKER_PLATFORM}")
 | 
			
		||||
	SET ( CPACK_PACKAGE_FILE_NAME "Hyperion.NG-${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}-${DOCKER_PLATFORM}")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
SET ( CPACK_PACKAGE_CONTACT "packages@hyperion-project.org")
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,11 @@ import json, sys
 | 
			
		||||
retval   = 0
 | 
			
		||||
 | 
			
		||||
with open(sys.argv[1]) as f:
 | 
			
		||||
	data = json.load(f)
 | 
			
		||||
	sys.stdout.write(data['versionnr'])
 | 
			
		||||
	sys.exit(0)
 | 
			
		||||
	if len(sys.argv) < 3:
 | 
			
		||||
		data = json.load(f)
 | 
			
		||||
		sys.stdout.write(data['versionnr'])
 | 
			
		||||
		sys.exit(0)
 | 
			
		||||
	else:
 | 
			
		||||
		data = json.load(f)
 | 
			
		||||
		sys.stdout.write(data['channel'])
 | 
			
		||||
		sys.exit(0)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user