Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GitVersion to increment build numbers #5682

Merged
merged 29 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4047597
Use GitVersion to increment build numbers
tobiasdiez Nov 28, 2019
6dcc788
Update deployment.yml
tobiasdiez Nov 28, 2019
b87ffe5
Update deployment.yml
tobiasdiez Nov 28, 2019
79182f2
Update deployment.yml
tobiasdiez Nov 28, 2019
56929ad
Update deployment.yml
tobiasdiez Nov 28, 2019
e784806
Create GitVersion.yml
tobiasdiez Nov 28, 2019
a9fbe50
Update GitVersion
tobiasdiez Nov 29, 2019
77dfd17
Update deployment.yml
tobiasdiez Nov 30, 2019
f28d57c
Update deployment.yml
tobiasdiez Nov 30, 2019
943aa61
Update deployment.yml
tobiasdiez Nov 30, 2019
c4369e0
Update deployment.yml
tobiasdiez Nov 30, 2019
c4b72df
Update GitVersion.yml
tobiasdiez Nov 30, 2019
d6af52a
Update GitVersion.yml
tobiasdiez Nov 30, 2019
02653a6
Update build.gradle
tobiasdiez Nov 30, 2019
e3463bd
Update deployment.yml
tobiasdiez Nov 30, 2019
5148dcf
Update deployment.yml
tobiasdiez Nov 30, 2019
8691241
Update deployment.yml
tobiasdiez Nov 30, 2019
09dde73
Update deployment.yml
tobiasdiez Nov 30, 2019
596a4f9
Update deployment.yml
tobiasdiez Dec 2, 2019
7ac2ff5
Upgrade git checkout action
tobiasdiez Dec 3, 2019
6f26837
Remove (opsolete) checkout config
tobiasdiez Dec 3, 2019
b82bc73
Try to unshallow
tobiasdiez Dec 3, 2019
81d9506
Update deployment.yml
tobiasdiez Dec 3, 2019
d62d76c
Update deployment.yml
tobiasdiez Dec 3, 2019
c002482
Update deployment.yml
tobiasdiez Dec 3, 2019
5b44890
Update deployment.yml
tobiasdiez Dec 3, 2019
08b7e6f
Update deployment.yml
tobiasdiez Dec 3, 2019
9ee32a5
Update GitVersion.yml
tobiasdiez Dec 4, 2019
7ed0d61
Change default product version to 100.0.0
tobiasdiez Dec 4, 2019
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
21 changes: 19 additions & 2 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ jobs:
ref=${ref%/merge}
echo "##[set-output name=branch;]${ref}"
id: extract_branch
- name: Reattach head, fetch tags and master for GitVersion
run: |
git checkout "${{ steps.extract_branch.outputs.branch }}"
git branch --create-reflog master origin/master
git fetch --tags origin
- name: Install GitVersion
uses: gittools/actions/setup-gitversion@v0.3
with:
versionSpec: '5.1.x'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/execute-gitversion@v0.3
- name: Set up JDK
uses: actions/setup-java@v1
with:
Expand Down Expand Up @@ -77,11 +89,11 @@ jobs:
zip.close()
shell: python
- name: Build runtime image
run: ./gradlew -Pdev=true jlinkZip
run: ./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jlinkZip
- name: Build installer
run: |
export BADASS_JLINK_JPACKAGE_HOME="${GITHUB_WORKSPACE}${{ matrix.jdk14Path }}"
./gradlew -Pdev=true jpackage
./gradlew -PprojVersion="${{ steps.gitversion.outputs.AssemblySemVer }}" -PprojVersionInfo="${{ steps.gitversion.outputs.InformationalVersion }}" jpackage
shell: bash
- name: Add installer as artifact
uses: actions/upload-artifact@master
Expand All @@ -99,6 +111,11 @@ jobs:
mkdir .snapcraft && echo ${SNAPCRAFT_LOGIN_FILE} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg
docker run -v $(pwd):$(pwd) -t lyzardking/snapcraft-bionic sh -c "apt update -qq && cd $(pwd) && snapcraft && mv jabref*.snap build/distribution/ && snapcraft push build/distribution/jabref*.snap --release edge || true"
shell: bash
- name: Rename files
run: |
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "${{ steps.gitversion.outputs.AssemblySemVer }}","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}"}
get-childitem -Path build/distribution/* | rename-item -NewName {$_.name -replace "portable","${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}-portable"}
shell: pwsh
- name: Upload to builds.jabref.org
uses: garygrossgarten/github-action-scp@release
with:
Expand Down
2 changes: 2 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
assembly-versioning-format: '{major}.{minor}.{buildmetadata}'
assembly-informational-format: '{major}.{minor}{PreReleaseTagWithDash}'
36 changes: 2 additions & 34 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ apply plugin: LocalizationPlugin
apply from: 'eclipse.gradle'

group = "org.jabref"
version = "5.0.0"
version = project.findProperty('projVersion') ?: '0.0.1'

sourceCompatibility = 13
targetCompatibility = 13
Expand Down Expand Up @@ -280,7 +280,7 @@ processResources {
filteringCharset = 'UTF-8'

filesMatching("build.properties") {
expand(version: createVersionString(),
expand(version: project.findProperty('projVersionInfo') ?: '0.0.1',
"year": String.valueOf(Calendar.getInstance().get(Calendar.YEAR)),
"authors": new File('AUTHORS').readLines().findAll { !it.startsWith("#") }.join(", "),
"developers": new File('DEVELOPERS').readLines().findAll { !it.startsWith("#") }.join(", "),
Expand Down Expand Up @@ -716,35 +716,3 @@ task bundleLibreOffice(type: Jar) {
destinationDir = file('lib')
archiveName = 'libreoffice.jar'
}

// Returns the value of project.version in production and a string of the format VERSION-dev--DATE--BRANCH--GIT_HASH for development versions
def createVersionString() {
if (hasProperty('dev')) {
String command = "git log --pretty=format:%cd--%h -n 1 --date=short"
String commitInfo
if (OperatingSystem.current().isWindows()) {
commitInfo = "cmd /c $command".execute().in.text
} else {
commitInfo = command.execute().in.text
}

// determine branch
command = "git symbolic-ref -q --short HEAD"
String branchName
if (OperatingSystem.current().isWindows()) {
branchName = "cmd /c $command".execute().in.text
} else {
branchName = command.execute().in.text
}
// A newline is returned. Remove it. (trim())
// In the context of github, the branch name could be something like "pull/277"
// "/" is an illegal character. To be safe, all illegal filename characters are replaced by "_"
// http://stackoverflow.com/a/15075907/873282 describes the used pattern.
branchName = branchName.trim().replaceAll("[^a-zA-Z0-9.-]", "_")

// first the date (%cd), then the branch name, and finally the commit id (%h)
return project.version + "-dev--" + commitInfo.substring(0, 10) + "--" + branchName + "--" + commitInfo.substring(12)
} else {
return project.version
}
}