SYNERGY-400 Make build for every merge to master (#6885)
* SYNERGY-400 Generate build number and create release with tag * SYNERGY-400 Changes for Azure Piplines * Update ChangeLog
This commit is contained in:
parent
fbd32a9797
commit
a1640d0b32
12 changed files with 369 additions and 20 deletions
10
.github/actions/build-number/action.yml
vendored
Normal file
10
.github/actions/build-number/action.yml
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
name: 'Generate next build number'
|
||||||
|
description: 'Generate next build number'
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
build-number:
|
||||||
|
description: 'Generated build number'
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: 'node12'
|
||||||
|
main: 'build-number.js'
|
||||||
172
.github/actions/build-number/build-number.js
vendored
Normal file
172
.github/actions/build-number/build-number.js
vendored
Normal file
|
|
@ -0,0 +1,172 @@
|
||||||
|
const core = require('@actions/core');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
function VersionPart(part) {
|
||||||
|
var self = this;
|
||||||
|
var m_prefix = '';
|
||||||
|
var m_suffix = '';
|
||||||
|
var m_number = 0;
|
||||||
|
|
||||||
|
self.setNumber = function(number) {
|
||||||
|
if (!isNaN(number)) {
|
||||||
|
m_number = number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.getNumber = function() {
|
||||||
|
return m_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.toString = function() {
|
||||||
|
return m_prefix + m_number.toString() + m_suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.next = function() {
|
||||||
|
m_number += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parsePartPrefix(part) {
|
||||||
|
if (isNaN(part[0])) {
|
||||||
|
for (var i = 0; i < part.length; ++i) {
|
||||||
|
if (!isNaN(part[i])) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_prefix += part[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parsePartNumber(part) {
|
||||||
|
let number = 0;
|
||||||
|
|
||||||
|
if (m_prefix.length > 0){
|
||||||
|
number = parseInt(part.substring(m_prefix.length));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
number = parseInt(part);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.setNumber(number);
|
||||||
|
}
|
||||||
|
|
||||||
|
function parsePartSuffix(part) {
|
||||||
|
let items = part.split('-');
|
||||||
|
if (items.length == 2) {
|
||||||
|
m_suffix = '-' + items[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.setPart = function(part) {
|
||||||
|
if (part && part.length > 0){
|
||||||
|
parsePartPrefix(part);
|
||||||
|
parsePartNumber(part);
|
||||||
|
parsePartSuffix(part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.setPart(part);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Version(version) {
|
||||||
|
const PARTS_DELIMITER = '.';
|
||||||
|
var m_major = new VersionPart();
|
||||||
|
var m_minor = new VersionPart();
|
||||||
|
var m_patch = new VersionPart();
|
||||||
|
var m_build = new VersionPart();
|
||||||
|
|
||||||
|
this.toString = function() {
|
||||||
|
return ( m_major.toString() + PARTS_DELIMITER +
|
||||||
|
m_minor.toString() + PARTS_DELIMITER +
|
||||||
|
m_patch.toString() + PARTS_DELIMITER +
|
||||||
|
m_build.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.nextBuild = function() {
|
||||||
|
m_build.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
let versionParts = version.split(PARTS_DELIMITER);
|
||||||
|
|
||||||
|
if (versionParts.length == 3) {
|
||||||
|
m_major.setPart(versionParts[0]);
|
||||||
|
m_minor.setPart(versionParts[1]);
|
||||||
|
m_build.setPart(versionParts[2]);
|
||||||
|
m_patch.setNumber(m_build.getNumber());
|
||||||
|
}
|
||||||
|
else if (versionParts.length == 4) {
|
||||||
|
m_major.setPart(versionParts[0]);
|
||||||
|
m_minor.setPart(versionParts[1]);
|
||||||
|
m_patch.setPart(versionParts[2]);
|
||||||
|
m_build.setPart(versionParts[3]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.setFailed('ERROR: previous-build contains wrong version number <' + version + '>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getMajor = function() {
|
||||||
|
return m_major.getNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getMinor = function() {
|
||||||
|
return m_minor.getNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getPatch = function() {
|
||||||
|
return m_patch.getNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isSamePatch = function(version) {
|
||||||
|
return (m_major.getNumber() == version.getMajor() &&
|
||||||
|
m_minor.getNumber() == version.getMinor() &&
|
||||||
|
m_patch.getNumber() == version.getPatch());
|
||||||
|
}
|
||||||
|
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOptionValue(source, option) {
|
||||||
|
let start = source.indexOf(option);
|
||||||
|
if (start != -1) {
|
||||||
|
start += option.length + 1;
|
||||||
|
let end = source.indexOf(')', start);
|
||||||
|
return source.toString('utf8', start, end).replace(/\"/g, '').trim();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
core.setFailed("ERROR: Can't find option <" + option + ">");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVersionFromFile(){
|
||||||
|
let options = fs.readFileSync('cmake/Version.cmake');
|
||||||
|
let major = getOptionValue(options, 'SYNERGY_VERSION_MAJOR');
|
||||||
|
let minor = getOptionValue(options, 'SYNERGY_VERSION_MINOR');
|
||||||
|
let patch = getOptionValue(options, 'SYNERGY_VERSION_PATCH');
|
||||||
|
let stage = getOptionValue(options, 'SYNERGY_VERSION_STAGE');
|
||||||
|
|
||||||
|
return (major + '.' + minor + '.' + patch + '-' + stage);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
let version = null;
|
||||||
|
let gitVersion = new Version(core.getInput('previous-build'));
|
||||||
|
let cmakeVersion = new Version(getVersionFromFile());
|
||||||
|
|
||||||
|
console.log('INFO: Version from Git: <' + gitVersion.toString() + '>');
|
||||||
|
console.log('INFO: Version from cmake: <' + cmakeVersion.toString() + '>');
|
||||||
|
|
||||||
|
if (cmakeVersion.isSamePatch(gitVersion)) {
|
||||||
|
gitVersion.nextBuild();
|
||||||
|
version = gitVersion;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
version = cmakeVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('INFO: Generate build version: <' + version.toString() + '>');
|
||||||
|
core.setOutput('next-build', version.toString());
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
core.setFailed(error.message);
|
||||||
|
}
|
||||||
45
.github/workflows/create-build.yml
vendored
Normal file
45
.github/workflows/create-build.yml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
name: Create Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: 'Get Previous tag'
|
||||||
|
id: previoustag
|
||||||
|
uses: "WyriHaximus/github-action-get-previous-tag@master"
|
||||||
|
|
||||||
|
- name: 'Install git core'
|
||||||
|
run: npm install @actions/core
|
||||||
|
|
||||||
|
- name: 'Generate next build number'
|
||||||
|
id: build
|
||||||
|
uses: "./.github/actions/build-number"
|
||||||
|
with:
|
||||||
|
previous-build: ${{ steps.previoustag.outputs.tag }}
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.build.outputs.next-build }}
|
||||||
|
release_name: Version ${{ steps.build.outputs.next-build }}
|
||||||
|
commitish: master
|
||||||
|
draft: false
|
||||||
|
prerelease: true
|
||||||
|
|
||||||
|
- name: Run build on Azure
|
||||||
|
uses: Azure/pipelines@v1
|
||||||
|
with:
|
||||||
|
azure-devops-project-url: 'https://dev.azure.com/symless/synergy-core'
|
||||||
|
azure-pipeline-name: 'symless.synergy-core'
|
||||||
|
azure-devops-token: '${{ secrets.AZURE_DEVOPS_TOKEN }}'
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
steps:
|
steps:
|
||||||
|
- script: |
|
||||||
|
python3 CI/build_version.py
|
||||||
|
displayName: 'Update Version.cmake'
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
mkdir build-release
|
mkdir build-release
|
||||||
cd build-release
|
cd build-release
|
||||||
|
|
@ -56,6 +60,7 @@ steps:
|
||||||
SYNERGY_REVISION=`git rev-parse --short=8 HEAD`
|
SYNERGY_REVISION=`git rev-parse --short=8 HEAD`
|
||||||
SYNERGY_DEB_VERSION="${SYNERGY_VERSION}.${SYNERGY_VERSION_STAGE}~b$(Build.BuildNumber)+${SYNERGY_REVISION}"
|
SYNERGY_DEB_VERSION="${SYNERGY_VERSION}.${SYNERGY_VERSION_STAGE}~b$(Build.BuildNumber)+${SYNERGY_REVISION}"
|
||||||
SYNERGY_RPM_VERSION="${SYNERGY_VERSION}-$(Build.BuildNumber).${SYNERGY_VERSION_STAGE}.${SYNERGY_REVISION}"
|
SYNERGY_RPM_VERSION="${SYNERGY_VERSION}-$(Build.BuildNumber).${SYNERGY_VERSION_STAGE}.${SYNERGY_REVISION}"
|
||||||
|
echo "##vso[task.setvariable variable=SYNERGY_VERSION_BUILD]${SYNERGY_VERSION_BUILD}"
|
||||||
echo "##vso[task.setvariable variable=SYNERGY_VERSION_STAGE]${SYNERGY_VERSION_STAGE}"
|
echo "##vso[task.setvariable variable=SYNERGY_VERSION_STAGE]${SYNERGY_VERSION_STAGE}"
|
||||||
echo "##vso[task.setvariable variable=SYNERGY_VERSION]${SYNERGY_VERSION}"
|
echo "##vso[task.setvariable variable=SYNERGY_VERSION]${SYNERGY_VERSION}"
|
||||||
echo "##vso[task.setvariable variable=SYNERGY_REVISION]${SYNERGY_REVISION}"
|
echo "##vso[task.setvariable variable=SYNERGY_REVISION]${SYNERGY_REVISION}"
|
||||||
|
|
@ -145,7 +150,7 @@ steps:
|
||||||
sshEndpoint: 'Azure on Sandor'
|
sshEndpoint: 'Azure on Sandor'
|
||||||
sourceFolder: './standard_package'
|
sourceFolder: './standard_package'
|
||||||
contents: '*'
|
contents: '*'
|
||||||
targetFolder: 'synergy-core/v1-core-standard/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/$(SYNERGY_REVISION)/'
|
targetFolder: 'synergy-core/v1-core-standard/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/b$(SYNERGY_VERSION_BUILD)-$(SYNERGY_REVISION)/'
|
||||||
readyTimeout: '20000'
|
readyTimeout: '20000'
|
||||||
displayName: 'Send standard Package to sandor'
|
displayName: 'Send standard Package to sandor'
|
||||||
condition: eq(variables['Build.Reason'], 'Manual')
|
condition: eq(variables['Build.Reason'], 'Manual')
|
||||||
|
|
@ -155,7 +160,7 @@ steps:
|
||||||
sshEndpoint: 'Azure on Sandor'
|
sshEndpoint: 'Azure on Sandor'
|
||||||
sourceFolder: './enterprise_package'
|
sourceFolder: './enterprise_package'
|
||||||
contents: '*'
|
contents: '*'
|
||||||
targetFolder: 'synergy-core/v1-core-enterprise/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/$(SYNERGY_REVISION)/'
|
targetFolder: 'synergy-core/v1-core-enterprise/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/b$(SYNERGY_VERSION_BUILD)-$(SYNERGY_REVISION)/'
|
||||||
readyTimeout: '20000'
|
readyTimeout: '20000'
|
||||||
displayName: 'Send enterprise Package to sandor'
|
displayName: 'Send enterprise Package to sandor'
|
||||||
condition: eq(variables['Build.Reason'], 'Manual')
|
condition: eq(variables['Build.Reason'], 'Manual')
|
||||||
|
|
@ -6,6 +6,12 @@ steps:
|
||||||
keychain: 'temp'
|
keychain: 'temp'
|
||||||
condition: eq(variables['Build.Reason'], 'Manual')
|
condition: eq(variables['Build.Reason'], 'Manual')
|
||||||
|
|
||||||
|
- task: CmdLine@2
|
||||||
|
inputs:
|
||||||
|
script: |
|
||||||
|
python3 CI/build_version.py
|
||||||
|
displayName: 'Update Version.cmake'
|
||||||
|
|
||||||
- task: CmdLine@2
|
- task: CmdLine@2
|
||||||
inputs:
|
inputs:
|
||||||
script: |
|
script: |
|
||||||
|
|
@ -74,6 +80,7 @@ steps:
|
||||||
SYNERGY_DMG_VERSION="${SYNERGY_VERSION}-${SYNERGY_VERSION_STAGE}_b$(Build.BuildNumber)-${SYNERGY_REVISION}"
|
SYNERGY_DMG_VERSION="${SYNERGY_VERSION}-${SYNERGY_VERSION_STAGE}_b$(Build.BuildNumber)-${SYNERGY_REVISION}"
|
||||||
SYNERGY_DMG_FILENAME=$(prefix)_v${SYNERGY_DMG_VERSION}_macos_$(platform).dmg
|
SYNERGY_DMG_FILENAME=$(prefix)_v${SYNERGY_DMG_VERSION}_macos_$(platform).dmg
|
||||||
echo "##vso[task.setvariable variable=SYNERGY_VERSION_STAGE]${SYNERGY_VERSION_STAGE}"
|
echo "##vso[task.setvariable variable=SYNERGY_VERSION_STAGE]${SYNERGY_VERSION_STAGE}"
|
||||||
|
echo "##vso[task.setvariable variable=SYNERGY_VERSION_BUILD]${SYNERGY_VERSION_BUILD}"
|
||||||
echo "##vso[task.setvariable variable=SYNERGY_VERSION]${SYNERGY_VERSION}"
|
echo "##vso[task.setvariable variable=SYNERGY_VERSION]${SYNERGY_VERSION}"
|
||||||
echo "##vso[task.setvariable variable=SYNERGY_REVISION]${SYNERGY_REVISION}"
|
echo "##vso[task.setvariable variable=SYNERGY_REVISION]${SYNERGY_REVISION}"
|
||||||
echo "##vso[task.setvariable variable=SYNERGY_DMG_VERSION]${SYNERGY_DMG_VERSION}"
|
echo "##vso[task.setvariable variable=SYNERGY_DMG_VERSION]${SYNERGY_DMG_VERSION}"
|
||||||
|
|
@ -114,7 +121,7 @@ steps:
|
||||||
sshEndpoint: 'Azure on Sandor'
|
sshEndpoint: 'Azure on Sandor'
|
||||||
sourceFolder: '$(Build.Repository.LocalPath)/pkg'
|
sourceFolder: '$(Build.Repository.LocalPath)/pkg'
|
||||||
contents: '*'
|
contents: '*'
|
||||||
targetFolder: 'synergy-core/v1-core-$(buildType)/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/$(SYNERGY_REVISION)/'
|
targetFolder: 'synergy-core/v1-core-$(buildType)/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/b$(SYNERGY_VERSION_BUILD)-$(SYNERGY_REVISION)/'
|
||||||
readyTimeout: '20000'
|
readyTimeout: '20000'
|
||||||
displayName: 'Send Package to sandor'
|
displayName: 'Send Package to sandor'
|
||||||
condition: eq(variables['Build.Reason'], 'Manual')
|
condition: eq(variables['Build.Reason'], 'Manual')
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ steps:
|
||||||
architecture: 'x64'
|
architecture: 'x64'
|
||||||
displayName: 'Set python version'
|
displayName: 'Set python version'
|
||||||
|
|
||||||
|
- script: |
|
||||||
|
python3 CI/build_version.py
|
||||||
|
displayName: 'Update Version.cmake'
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
cd $(Build.SourcesDirectory)
|
cd $(Build.SourcesDirectory)
|
||||||
python -m pip install aqtinstall
|
python -m pip install aqtinstall
|
||||||
|
|
@ -170,6 +174,7 @@ steps:
|
||||||
set SYNERGY_VERSION=%SYNERGY_VERSION_MAJOR%.%SYNERGY_VERSION_MINOR%.%SYNERGY_VERSION_PATCH%
|
set SYNERGY_VERSION=%SYNERGY_VERSION_MAJOR%.%SYNERGY_VERSION_MINOR%.%SYNERGY_VERSION_PATCH%
|
||||||
git rev-parse --short=8 HEAD > gitversion
|
git rev-parse --short=8 HEAD > gitversion
|
||||||
set /p SYNERGY_REVISION= < gitversion
|
set /p SYNERGY_REVISION= < gitversion
|
||||||
|
echo ##vso[task.setvariable variable=SYNERGY_VERSION_BUILD]%SYNERGY_VERSION_BUILD%
|
||||||
echo ##vso[task.setvariable variable=SYNERGY_VERSION_STAGE]%SYNERGY_VERSION_STAGE%
|
echo ##vso[task.setvariable variable=SYNERGY_VERSION_STAGE]%SYNERGY_VERSION_STAGE%
|
||||||
echo ##vso[task.setvariable variable=SYNERGY_VERSION]%SYNERGY_VERSION%
|
echo ##vso[task.setvariable variable=SYNERGY_VERSION]%SYNERGY_VERSION%
|
||||||
echo ##vso[task.setvariable variable=SYNERGY_REVISION]%SYNERGY_REVISION%
|
echo ##vso[task.setvariable variable=SYNERGY_REVISION]%SYNERGY_REVISION%
|
||||||
|
|
@ -197,7 +202,7 @@ steps:
|
||||||
sshEndpoint: 'Azure on Sandor'
|
sshEndpoint: 'Azure on Sandor'
|
||||||
sourceFolder: '$(Build.ArtifactStagingDirectory)/'
|
sourceFolder: '$(Build.ArtifactStagingDirectory)/'
|
||||||
contents: '*.zip'
|
contents: '*.zip'
|
||||||
targetFolder: 'synergy-core/v1-core-$(buildType)/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/$(SYNERGY_REVISION)/'
|
targetFolder: 'synergy-core/v1-core-$(buildType)/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/b$(SYNERGY_VERSION_BUILD)-$(SYNERGY_REVISION)/'
|
||||||
readyTimeout: '20000'
|
readyTimeout: '20000'
|
||||||
displayName: 'Send archives to sandor'
|
displayName: 'Send archives to sandor'
|
||||||
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
|
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
|
||||||
|
|
@ -207,7 +212,7 @@ steps:
|
||||||
sshEndpoint: 'Azure on Sandor'
|
sshEndpoint: 'Azure on Sandor'
|
||||||
sourceFolder: '$(Build.Repository.LocalPath)\build32\installer\bin\Release\'
|
sourceFolder: '$(Build.Repository.LocalPath)\build32\installer\bin\Release\'
|
||||||
contents: '*'
|
contents: '*'
|
||||||
targetFolder: 'synergy-core/v1-core-$(buildType)/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/$(SYNERGY_REVISION)/'
|
targetFolder: 'synergy-core/v1-core-$(buildType)/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/b$(SYNERGY_VERSION_BUILD)-$(SYNERGY_REVISION)/'
|
||||||
readyTimeout: '20000'
|
readyTimeout: '20000'
|
||||||
displayName: 'Send x86 Package to sandor'
|
displayName: 'Send x86 Package to sandor'
|
||||||
condition: eq(variables['Build.Reason'], 'Manual')
|
condition: eq(variables['Build.Reason'], 'Manual')
|
||||||
|
|
@ -217,7 +222,7 @@ steps:
|
||||||
sshEndpoint: 'Azure on Sandor'
|
sshEndpoint: 'Azure on Sandor'
|
||||||
sourceFolder: '$(Build.Repository.LocalPath)\build64\installer\bin\Release\'
|
sourceFolder: '$(Build.Repository.LocalPath)\build64\installer\bin\Release\'
|
||||||
contents: '*'
|
contents: '*'
|
||||||
targetFolder: 'synergy-core/v1-core-$(buildType)/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/$(SYNERGY_REVISION)/'
|
targetFolder: 'synergy-core/v1-core-$(buildType)/$(SYNERGY_VERSION)/$(SYNERGY_VERSION_STAGE)/b$(SYNERGY_VERSION_BUILD)-$(SYNERGY_REVISION)/'
|
||||||
readyTimeout: '20000'
|
readyTimeout: '20000'
|
||||||
displayName: 'Send x64 Package to sandor'
|
displayName: 'Send x64 Package to sandor'
|
||||||
condition: eq(variables['Build.Reason'], 'Manual')
|
condition: eq(variables['Build.Reason'], 'Manual')
|
||||||
|
|
|
||||||
109
CI/build_version.py
Normal file
109
CI/build_version.py
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
class VersionPart:
|
||||||
|
|
||||||
|
def __init__(self, part = ''):
|
||||||
|
self.prefix = ''
|
||||||
|
self.suffix = ''
|
||||||
|
self.number = 0
|
||||||
|
|
||||||
|
if part:
|
||||||
|
self.__parsePreffix(part)
|
||||||
|
self.__parseNumber(part)
|
||||||
|
self.__parseSuffix(part)
|
||||||
|
|
||||||
|
def __parsePreffix(self, part):
|
||||||
|
if not part[0].isdigit():
|
||||||
|
for i in part:
|
||||||
|
if not i.isdigit():
|
||||||
|
self.prefix += i
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
def __parseNumber(self, part):
|
||||||
|
start = len(self.prefix)
|
||||||
|
end = part.find('-')
|
||||||
|
if end > 0:
|
||||||
|
self.number = int(part[start:end])
|
||||||
|
else:
|
||||||
|
self.number = int(part[start:])
|
||||||
|
|
||||||
|
def __parseSuffix(self, part):
|
||||||
|
items = part.split('-')
|
||||||
|
if len(items) == 2:
|
||||||
|
self.suffix = '-' + items[1]
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.prefix + str(self.number) + self.suffix
|
||||||
|
|
||||||
|
class Version:
|
||||||
|
|
||||||
|
def __init__(self, version):
|
||||||
|
versionParts = version.split('.')
|
||||||
|
|
||||||
|
if len(versionParts) == 3:
|
||||||
|
self.major = VersionPart(versionParts[0])
|
||||||
|
self.minor = VersionPart(versionParts[1])
|
||||||
|
self.build = VersionPart(versionParts[2])
|
||||||
|
self.patch = VersionPart()
|
||||||
|
self.patch.number = self.build.number
|
||||||
|
elif len(versionParts) == 4:
|
||||||
|
self.major = VersionPart(versionParts[0])
|
||||||
|
self.minor = VersionPart(versionParts[1])
|
||||||
|
self.patch = VersionPart(versionParts[2])
|
||||||
|
self.build = VersionPart(versionParts[3])
|
||||||
|
else:
|
||||||
|
print('ERROR: Wrong version number')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
result = str(self.major) + '.'
|
||||||
|
result += str(self.minor) + '.'
|
||||||
|
result += str(self.patch) + '.'
|
||||||
|
result += str(self.build)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def nextBuild(self):
|
||||||
|
self.build.number += 1
|
||||||
|
|
||||||
|
class VersionFile:
|
||||||
|
def __init__(self, file):
|
||||||
|
self.file = file
|
||||||
|
|
||||||
|
def setOption(self, name, value):
|
||||||
|
fp = open(self.file, 'rt+')
|
||||||
|
content = ''
|
||||||
|
for line in fp:
|
||||||
|
print(line)
|
||||||
|
if line.find(name) != -1:
|
||||||
|
line = 'set ('+ name + ' ' + value + ')'
|
||||||
|
content += line
|
||||||
|
fp.write(content)
|
||||||
|
fp.close()
|
||||||
|
|
||||||
|
|
||||||
|
def getVesionFromGit():
|
||||||
|
cmd = ('git tag --sort=-creatordate').split()
|
||||||
|
|
||||||
|
try:
|
||||||
|
proccess = subprocess.run(cmd, stdout=subprocess.PIPE, text=True)
|
||||||
|
versions = proccess.stdout.split()
|
||||||
|
print('INFO: Version '+ versions[0] + ' has been read from git')
|
||||||
|
return versions[0]
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
print('ERROR: Unable to get version from git')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
def updateVersionFile(number):
|
||||||
|
fp = open('cmake/Version.cmake')
|
||||||
|
content = fp.read()
|
||||||
|
fp.close()
|
||||||
|
|
||||||
|
fp = open('cmake/Version.cmake', 'wt')
|
||||||
|
fp.write(content.replace('set (SYNERGY_VERSION_BUILD 1)', 'set (SYNERGY_VERSION_BUILD ' + str(number) + ')'))
|
||||||
|
fp.close()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
version = Version(getVesionFromGit())
|
||||||
|
version.nextBuild()
|
||||||
|
updateVersionFile(version.build.number)
|
||||||
|
print('INFO: Generate build number is: <' + str(version) + '>')
|
||||||
|
|
@ -391,12 +391,14 @@ macro(generate_versionfile)
|
||||||
"export SYNERGY_VERSION_MAJOR=\"${SYNERGY_VERSION_MAJOR}\"\n"
|
"export SYNERGY_VERSION_MAJOR=\"${SYNERGY_VERSION_MAJOR}\"\n"
|
||||||
"export SYNERGY_VERSION_MINOR=\"${SYNERGY_VERSION_MINOR}\"\n"
|
"export SYNERGY_VERSION_MINOR=\"${SYNERGY_VERSION_MINOR}\"\n"
|
||||||
"export SYNERGY_VERSION_PATCH=\"${SYNERGY_VERSION_PATCH}\"\n"
|
"export SYNERGY_VERSION_PATCH=\"${SYNERGY_VERSION_PATCH}\"\n"
|
||||||
|
"export SYNERGY_VERSION_BUILD=\"${SYNERGY_VERSION_BUILD}\"\n"
|
||||||
"export SYNERGY_VERSION_STAGE=\"${SYNERGY_VERSION_STAGE}\"\n")
|
"export SYNERGY_VERSION_STAGE=\"${SYNERGY_VERSION_STAGE}\"\n")
|
||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
FILE(WRITE ${CMAKE_BINARY_DIR}/version.bat
|
FILE(WRITE ${CMAKE_BINARY_DIR}/version.bat
|
||||||
"SET SYNERGY_VERSION_MAJOR=${SYNERGY_VERSION_MAJOR}\n"
|
"SET SYNERGY_VERSION_MAJOR=${SYNERGY_VERSION_MAJOR}\n"
|
||||||
"SET SYNERGY_VERSION_MINOR=${SYNERGY_VERSION_MINOR}\n"
|
"SET SYNERGY_VERSION_MINOR=${SYNERGY_VERSION_MINOR}\n"
|
||||||
"SET SYNERGY_VERSION_PATCH=${SYNERGY_VERSION_PATCH}\n"
|
"SET SYNERGY_VERSION_PATCH=${SYNERGY_VERSION_PATCH}\n"
|
||||||
|
"SET SYNERGY_VERSION_BUILD=${SYNERGY_VERSION_BUILD}\n"
|
||||||
"SET SYNERGY_VERSION_STAGE=${SYNERGY_VERSION_STAGE}\n")
|
"SET SYNERGY_VERSION_STAGE=${SYNERGY_VERSION_STAGE}\n")
|
||||||
endif()
|
endif()
|
||||||
endmacro(generate_versionfile)
|
endmacro(generate_versionfile)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ Bug fixes:
|
||||||
|
|
||||||
Enhancements:
|
Enhancements:
|
||||||
- #6867 Create only 1 artefact for macOS
|
- #6867 Create only 1 artefact for macOS
|
||||||
|
- #6885 Make build for every merge to master
|
||||||
|
|
||||||
v1.13.0-rc2
|
v1.13.0-rc2
|
||||||
===========
|
===========
|
||||||
|
|
|
||||||
|
|
@ -69,13 +69,13 @@ jobs:
|
||||||
catalina-std:
|
catalina-std:
|
||||||
image: macOS-10.15
|
image: macOS-10.15
|
||||||
platform: x86-64
|
platform: x86-64
|
||||||
version: 10.14
|
version: 10.15
|
||||||
buildType: "standard"
|
buildType: "standard"
|
||||||
prefix: "synergy"
|
prefix: "synergy"
|
||||||
catalina-ent:
|
catalina-ent:
|
||||||
image: macOS-10.15
|
image: macOS-10.15
|
||||||
platform: x86-64
|
platform: x86-64
|
||||||
version: 10.14
|
version: 10.15
|
||||||
buildType: "enterprise"
|
buildType: "enterprise"
|
||||||
prefix: "synergy-enterprise"
|
prefix: "synergy-enterprise"
|
||||||
pool:
|
pool:
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ cmake_minimum_required (VERSION 3.4)
|
||||||
set (SYNERGY_VERSION_MAJOR 1)
|
set (SYNERGY_VERSION_MAJOR 1)
|
||||||
set (SYNERGY_VERSION_MINOR 13)
|
set (SYNERGY_VERSION_MINOR 13)
|
||||||
set (SYNERGY_VERSION_PATCH 0)
|
set (SYNERGY_VERSION_PATCH 0)
|
||||||
|
set (SYNERGY_VERSION_BUILD 1)
|
||||||
set (SYNERGY_VERSION_STAGE "rc2")
|
set (SYNERGY_VERSION_STAGE "rc2")
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
@ -53,20 +54,12 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (DEFINED ENV{BUILD_NUMBER})
|
if (DEFINED ENV{BUILD_NUMBER})
|
||||||
set (SYNERGY_BUILD_NUMBER $ENV{BUILD_NUMBER})
|
set (SYNERGY_VERSION_BUILD $ENV{BUILD_NUMBER})
|
||||||
else()
|
|
||||||
set (SYNERGY_BUILD_NUMBER 1)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
string (TIMESTAMP SYNERGY_BUILD_DATE "%Y%m%d" UTC)
|
string (TIMESTAMP SYNERGY_BUILD_DATE "%Y%m%d" UTC)
|
||||||
set (SYNERGY_SNAPSHOT_INFO ".${SYNERGY_VERSION_STAGE}.${SYNERGY_REVISION}")
|
set (SYNERGY_SNAPSHOT_INFO ".${SYNERGY_VERSION_STAGE}.${SYNERGY_REVISION}")
|
||||||
|
set (SYNERGY_VERSION_TAG "${SYNERGY_VERSION_STAGE}.b${SYNERGY_VERSION_BUILD}-${SYNERGY_REVISION}")
|
||||||
if (SYNERGY_VERSION_STAGE STREQUAL "snapshot")
|
|
||||||
set (SYNERGY_VERSION_TAG "${SYNERGY_VERSION_STAGE}.b${SYNERGY_BUILD_NUMBER}-${SYNERGY_REVISION}")
|
|
||||||
else()
|
|
||||||
set (SYNERGY_VERSION_TAG "${SYNERGY_VERSION_STAGE}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set (SYNERGY_VERSION "${SYNERGY_VERSION_MAJOR}.${SYNERGY_VERSION_MINOR}.${SYNERGY_VERSION_PATCH}")
|
set (SYNERGY_VERSION "${SYNERGY_VERSION_MAJOR}.${SYNERGY_VERSION_MINOR}.${SYNERGY_VERSION_PATCH}")
|
||||||
set (SYNERGY_VERSION_STRING "${SYNERGY_VERSION}-${SYNERGY_VERSION_TAG}")
|
set (SYNERGY_VERSION_STRING "${SYNERGY_VERSION}-${SYNERGY_VERSION_TAG}")
|
||||||
message (STATUS "Full Synergy version string is '" ${SYNERGY_VERSION_STRING} "'")
|
message (STATUS "Full Synergy version string is '" ${SYNERGY_VERSION_STRING} "'")
|
||||||
|
|
@ -75,7 +68,7 @@ add_definitions (-DSYNERGY_VERSION="${SYNERGY_VERSION}")
|
||||||
add_definitions (-DSYNERGY_VERSION_STRING="${SYNERGY_VERSION_STRING}")
|
add_definitions (-DSYNERGY_VERSION_STRING="${SYNERGY_VERSION_STRING}")
|
||||||
add_definitions (-DSYNERGY_REVISION="${SYNERGY_REVISION}")
|
add_definitions (-DSYNERGY_REVISION="${SYNERGY_REVISION}")
|
||||||
add_definitions (-DSYNERGY_BUILD_DATE="${SYNERGY_BUILD_DATE}")
|
add_definitions (-DSYNERGY_BUILD_DATE="${SYNERGY_BUILD_DATE}")
|
||||||
add_definitions (-DSYNERGY_BUILD_NUMBER=${SYNERGY_BUILD_NUMBER})
|
add_definitions (-DSYNERGY_VERSION_BUILD=${SYNERGY_VERSION_BUILD})
|
||||||
|
|
||||||
if (SYNERGY_DEVELOPER_MODE)
|
if (SYNERGY_DEVELOPER_MODE)
|
||||||
add_definitions (-DSYNERGY_DEVELOPER_MODE=1)
|
add_definitions (-DSYNERGY_DEVELOPER_MODE=1)
|
||||||
|
|
|
||||||
2
dist/rpm/synergy.spec.in
vendored
2
dist/rpm/synergy.spec.in
vendored
|
|
@ -7,7 +7,7 @@ Source: https://symless.com/synergy/downloads
|
||||||
Vendor: Symless
|
Vendor: Symless
|
||||||
Packager: Symless <engineering@symless.com>
|
Packager: Symless <engineering@symless.com>
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Release: @SYNERGY_BUILD_NUMBER@@SYNERGY_SNAPSHOT_INFO@%{?dist}
|
Release: @SYNERGY_VERSION_BUILD@@SYNERGY_SNAPSHOT_INFO@%{?dist}
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Synergy allows you to share one mouse and keyboard between multiple computers.
|
Synergy allows you to share one mouse and keyboard between multiple computers.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue