mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-19 12:07:27 -05:00
Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
5
.github/workflows/nightly.yml
vendored
5
.github/workflows/nightly.yml
vendored
@@ -14,6 +14,9 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
# Full history and tags, so the build can describe the commit relative to the latest version tag
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up JDK 27
|
- name: Set up JDK 27
|
||||||
uses: actions/setup-java@v6
|
uses: actions/setup-java@v6
|
||||||
@@ -34,7 +37,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Build Info file
|
- name: Create Build Info file
|
||||||
run: |
|
run: |
|
||||||
echo -e "ref: $GITHUB_REF \ncommit: $GITHUB_SHA\nbuild: $(date +"%Y-%m-%dT%H:%M:%SZ")" > build/image/build_info.txt
|
echo -e "ref: $GITHUB_REF \ncommit: $GITHUB_SHA\ndescribe: $(git describe --tags --match 'v[0-9]*' --dirty)\nbuild: $(date +"%Y-%m-%dT%H:%M:%SZ")" > build/image/build_info.txt
|
||||||
|
|
||||||
- name: Add build artifacts to nightly release
|
- name: Add build artifacts to nightly release
|
||||||
uses: softprops/action-gh-release@v3
|
uses: softprops/action-gh-release@v3
|
||||||
|
|||||||
26
.github/workflows/release.yml
vendored
26
.github/workflows/release.yml
vendored
@@ -1,6 +1,6 @@
|
|||||||
# Publishes a release when a version tag is pushed. The tag has to match
|
# Publishes a release when a version tag is pushed: v0.6.2 for a final release,
|
||||||
# projectVersion in gradle.properties with a leading 'v': v0.6.2 for a final
|
# or v0.6.2-beta-1 / v0.6.2-alpha-1 for a pre-release. The build derives the
|
||||||
# release, or v0.6.2-beta-1 / v0.6.2-alpha-1 for a pre-release.
|
# version from the tag (see build.gradle).
|
||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -22,15 +22,6 @@ jobs:
|
|||||||
# Full history and tags, to find the previous release tag for the release notes
|
# Full history and tags, to find the previous release tag for the release notes
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- id: version
|
|
||||||
run: |
|
|
||||||
expected="v$(sed -n 's/^projectVersion=//p' gradle.properties | tr -d '[:space:]')"
|
|
||||||
if [ "$GITHUB_REF_NAME" != "$expected" ]; then
|
|
||||||
echo "::error::Tag $GITHUB_REF_NAME does not match projectVersion in gradle.properties ($expected)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
# Release notes list the PRs since the previous version tag (never 'nightly'). A final release
|
# Release notes list the PRs since the previous version tag (never 'nightly'). A final release
|
||||||
# starts from the previous final release, so it covers every alpha and beta in between.
|
# starts from the previous final release, so it covers every alpha and beta in between.
|
||||||
- id: previous
|
- id: previous
|
||||||
@@ -54,6 +45,17 @@ jobs:
|
|||||||
- name: Set up Gradle
|
- name: Set up Gradle
|
||||||
uses: gradle/actions/setup-gradle@v6
|
uses: gradle/actions/setup-gradle@v6
|
||||||
|
|
||||||
|
# The version comes from 'git describe', which can pick a different tag when more than one
|
||||||
|
# version tag points at the same commit. Fail rather than publish zips with the wrong version.
|
||||||
|
- id: version
|
||||||
|
run: |
|
||||||
|
version="$(./gradlew -q printVersion --console=plain | tail -n 1)"
|
||||||
|
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
|
||||||
|
echo "::error::Build version $version does not match tag $GITHUB_REF_NAME"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
run: ./gradlew clean build --console=plain
|
run: ./gradlew clean build --console=plain
|
||||||
|
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -54,17 +54,19 @@ committed to the code base, so it's not really 'nightly' as much as it is 'curre
|
|||||||
Releases are built and published automatically by the [Release](.github/workflows/release.yml) GitHub workflow
|
Releases are built and published automatically by the [Release](.github/workflows/release.yml) GitHub workflow
|
||||||
whenever a version tag is pushed to the repository.
|
whenever a version tag is pushed to the repository.
|
||||||
|
|
||||||
1. Update `projectVersion` in `gradle.properties` to the new version, following the naming convention described in
|
The version is taken from the tag, so there is no version number to update in the code. Create and push a tag
|
||||||
that file (e.g. `0.6.2-alpha-1`, `0.6.2-beta-1` or `0.6.2`).
|
with a leading `v`, following the naming convention described in `gradle.properties` (e.g. `v0.6.2-alpha-1`,
|
||||||
2. Commit and push the change to `master`.
|
`v0.6.2-beta-1` or `v0.6.2`):
|
||||||
3. Create and push a tag that matches the version with a leading `v`:
|
|
||||||
```
|
```
|
||||||
git tag v0.6.2-beta-1
|
git tag v0.6.2-beta-1
|
||||||
git push origin v0.6.2-beta-1
|
git push origin v0.6.2-beta-1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Builds made from an untagged commit get a version like `0.6.2-beta-1-14-g4626d567` (14 commits after the
|
||||||
|
`v0.6.2-beta-1` tag, at commit `4626d567`), with `-dirty` appended when there are uncommitted changes.
|
||||||
|
|
||||||
The workflow then:
|
The workflow then:
|
||||||
* Verifies that the tag matches `projectVersion` in `gradle.properties` and fails if it does not.
|
* Verifies that the version the build derives from git matches the tag and fails if it does not.
|
||||||
* Builds and tests the code, then creates the release zips for Linux, Mac and Windows (x86-64 and aarch64).
|
* Builds and tests the code, then creates the release zips for Linux, Mac and Windows (x86-64 and aarch64).
|
||||||
* Creates a GitHub release titled `Version <version>` with auto-generated release notes (a "What's Changed" list of
|
* Creates a GitHub release titled `Version <version>` with auto-generated release notes (a "What's Changed" list of
|
||||||
the PRs merged since the previous version tag), and attaches the six zip
|
the PRs merged since the previous version tag), and attaches the six zip
|
||||||
|
|||||||
41
build.gradle
41
build.gradle
@@ -52,8 +52,44 @@ plugins {
|
|||||||
id 'org.beryx.runtime' version '2.0.1'
|
id 'org.beryx.runtime' version '2.0.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
//Version is defined in gradle.properties so that we can CLI override it for nightly builds.
|
/**
|
||||||
version = project.findProperty('projectVersion')
|
* Version is derived from the most recent 'v<version>' git tag (e.g. v1.0.0-beta-1 -> 1.0.0-beta-1). Commits after
|
||||||
|
* the tag produce a version like 1.0.0-beta-1-14-g4626d567 and uncommitted changes append '-dirty'. The moving
|
||||||
|
* 'nightly' tag is ignored. Override with -PprojectVersion=<version> (the nightly build uses 'nightly' so that the
|
||||||
|
* nightly release asset names stay the same). Falls back to 'unknown' when built outside a git checkout.
|
||||||
|
*/
|
||||||
|
String gitDescribe = describeGitVersion()
|
||||||
|
version = project.findProperty('projectVersion') ?: (gitDescribe ? gitDescribe.substring(1) : 'unknown')
|
||||||
|
|
||||||
|
String describeGitVersion()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
def describe = providers.exec {
|
||||||
|
commandLine 'git', 'describe', '--tags', '--match', 'v[0-9]*', '--dirty'
|
||||||
|
ignoreExitValue = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if(describe.result.get().exitValue == 0)
|
||||||
|
{
|
||||||
|
return describe.standardOutput.asText.get().trim()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
logger.warn("Unable to determine version from git tags: " + e.message)
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register('printVersion') {
|
||||||
|
description = 'Prints the project version'
|
||||||
|
def projectVersion = version
|
||||||
|
doLast {
|
||||||
|
println projectVersion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Java 27 is required for this version of the Project Panama preview/incubator feature
|
//Java 27 is required for this version of the Project Panama preview/incubator feature
|
||||||
java {
|
java {
|
||||||
@@ -202,6 +238,7 @@ jar {
|
|||||||
attributes (
|
attributes (
|
||||||
'Implementation-Title' : 'sdrtrunk project',
|
'Implementation-Title' : 'sdrtrunk project',
|
||||||
'Implementation-Version' : archiveVersion,
|
'Implementation-Version' : archiveVersion,
|
||||||
|
'Git-Describe' : gitDescribe ?: 'unknown',
|
||||||
'Created-By' : "Gradle ${gradle.gradleVersion}",
|
'Created-By' : "Gradle ${gradle.gradleVersion}",
|
||||||
'Build-Timestamp' : new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
|
'Build-Timestamp' : new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
|
||||||
'Build-JDK' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']}",
|
'Build-JDK' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']}",
|
||||||
|
|||||||
@@ -17,15 +17,16 @@
|
|||||||
# *****************************************************************************
|
# *****************************************************************************
|
||||||
#
|
#
|
||||||
|
|
||||||
# Version naming conventions:
|
# The project version is no longer defined here. It is derived from the most recent 'v<version>' git tag (see
|
||||||
# Alpha: maj.min.patch-alpha-build
|
# build.gradle) and can be overridden with -PprojectVersion=<version>.
|
||||||
# Beta: maj.min.patch-beta-build
|
|
||||||
# Release: maj.min.patch
|
|
||||||
#
|
#
|
||||||
# Example: 0.6.0-beta-5
|
# Version tag naming conventions:
|
||||||
|
# Alpha: vmaj.min.patch-alpha-build
|
||||||
|
# Beta: vmaj.min.patch-beta-build
|
||||||
|
# Release: vmaj.min.patch
|
||||||
#
|
#
|
||||||
# Note: this is so that the file names for the resultant release build products match the GitLab release asset
|
# Example: v0.6.0-beta-5
|
||||||
|
#
|
||||||
|
# Note: this is so that the file names for the resultant release build products match the GitHub release asset
|
||||||
# tag name, specifically the dashes inserted before and after the alpha/beta labels.
|
# tag name, specifically the dashes inserted before and after the alpha/beta labels.
|
||||||
# See: https://github.com/DSheirer/sdrtrunk/issues/1651
|
# See: https://github.com/DSheirer/sdrtrunk/issues/1651
|
||||||
|
|
||||||
projectVersion=1.0.0-beta-1
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* *****************************************************************************
|
* *****************************************************************************
|
||||||
* Copyright (C) 2014-2024 Dennis Sheirer
|
* Copyright (C) 2014-2026 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -133,6 +133,7 @@ public class ApplicationLog
|
|||||||
Attributes atts = findManifestAttributes();
|
Attributes atts = findManifestAttributes();
|
||||||
if (atts != null) {
|
if (atts != null) {
|
||||||
mLog.info("SDRTrunk Version : " + atts.getValue("Implementation-Version"));
|
mLog.info("SDRTrunk Version : " + atts.getValue("Implementation-Version"));
|
||||||
|
mLog.info("Git Describe : " + atts.getValue("Git-Describe"));
|
||||||
mLog.info("Gradle Version : " + atts.getValue("Created-By"));
|
mLog.info("Gradle Version : " + atts.getValue("Created-By"));
|
||||||
mLog.info("Build Timestamp : " + atts.getValue("Build-Timestamp"));
|
mLog.info("Build Timestamp : " + atts.getValue("Build-Timestamp"));
|
||||||
mLog.info("Build-JDK : " + atts.getValue("Build-JDK"));
|
mLog.info("Build-JDK : " + atts.getValue("Build-JDK"));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* *****************************************************************************
|
* *****************************************************************************
|
||||||
* Copyright (C) 2014-2024 Dennis Sheirer
|
* Copyright (C) 2014-2026 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -247,6 +247,7 @@ public class DiagnosticMonitor
|
|||||||
Attributes atts = findManifestAttributes();
|
Attributes atts = findManifestAttributes();
|
||||||
if (atts != null) {
|
if (atts != null) {
|
||||||
sb.append("\nVersion : " + atts.getValue("Implementation-Version"));
|
sb.append("\nVersion : " + atts.getValue("Implementation-Version"));
|
||||||
|
sb.append("\nGit Describe : " + atts.getValue("Git-Describe"));
|
||||||
sb.append("\nGradle Version : " + atts.getValue("Created-By"));
|
sb.append("\nGradle Version : " + atts.getValue("Created-By"));
|
||||||
sb.append("\nBuild Timestamp : " + atts.getValue("Build-Timestamp"));
|
sb.append("\nBuild Timestamp : " + atts.getValue("Build-Timestamp"));
|
||||||
sb.append("\nBuild-JDK : " + atts.getValue("Build-JDK"));
|
sb.append("\nBuild-JDK : " + atts.getValue("Build-JDK"));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* *****************************************************************************
|
* *****************************************************************************
|
||||||
* Copyright (C) 2014-2024 Dennis Sheirer
|
* Copyright (C) 2014-2026 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -48,6 +48,7 @@ public class SystemProperties
|
|||||||
private static String PROPERTIES_FILENAME = "SDRTrunk.properties";
|
private static String PROPERTIES_FILENAME = "SDRTrunk.properties";
|
||||||
private static String MANIFEST_VERSION = "Implementation-Version";
|
private static String MANIFEST_VERSION = "Implementation-Version";
|
||||||
private static String BUILD_TIMESTAMP = "Build-Timestamp";
|
private static String BUILD_TIMESTAMP = "Build-Timestamp";
|
||||||
|
private static String GIT_DESCRIBE = "Git-Describe";
|
||||||
|
|
||||||
private static SystemProperties INSTANCE;
|
private static SystemProperties INSTANCE;
|
||||||
private static Properties mProperties;
|
private static Properties mProperties;
|
||||||
@@ -217,12 +218,18 @@ public class SystemProperties
|
|||||||
{
|
{
|
||||||
String version = manifest.getMainAttributes().getValue(MANIFEST_VERSION);
|
String version = manifest.getMainAttributes().getValue(MANIFEST_VERSION);
|
||||||
String timestamp = manifest.getMainAttributes().getValue(BUILD_TIMESTAMP);
|
String timestamp = manifest.getMainAttributes().getValue(BUILD_TIMESTAMP);
|
||||||
|
String gitDescribe = manifest.getMainAttributes().getValue(GIT_DESCRIBE);
|
||||||
|
|
||||||
if(version != null)
|
if(version != null)
|
||||||
{
|
{
|
||||||
if(version.contains("nightly") && timestamp != null)
|
if(version.contains("nightly") && timestamp != null)
|
||||||
{
|
{
|
||||||
sb.append( " nightly - ").append(timestamp);
|
sb.append( " nightly - ").append(timestamp);
|
||||||
|
|
||||||
|
if(gitDescribe != null && !gitDescribe.equals("unknown"))
|
||||||
|
{
|
||||||
|
sb.append(" (").append(gitDescribe).append(")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user