Skip to content

Commit

Permalink
Update SNAPSHOT versioning strings
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgecrw committed Jun 27, 2023
1 parent d7ce906 commit 0489369
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ jobs:
id: gitsha
run: echo "sha=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT

- name: Get source code version number
id: gitversion
run: echo "version=$(grep -o "versionString = .*;" src/main/java/com/fazecast/jSerialComm/SerialPort.java | grep -o "\".*\"" | grep -o [^\"].*[^\"])" >> $GITHUB_OUTPUT

- name: Update library version string
run: sed -i "s/versionString = .*;/versionString = \"${{ steps.gitsha.outputs.sha }}-SNAPSHOT\";/g" src/main/java/com/fazecast/jSerialComm/SerialPort.java
run: sed -i "s/versionString = .*;/versionString = \"${{ steps.gitversion.outputs.version }}-${{ steps.gitsha.outputs.sha }}-SNAPSHOT\";/g" src/main/java/com/fazecast/jSerialComm/SerialPort.java

- name: Build native libraries using Docker toolchain
uses: addnab/docker-run-action@v3
Expand All @@ -35,15 +39,15 @@ jobs:
- name: Build SNAPSHOT using Gradle
uses: gradle/gradle-build-action@v2.4.2
env:
LIB_VERSION: ${{ steps.gitsha.outputs.sha }}-SNAPSHOT
LIB_VERSION: ${{ steps.gitversion.outputs.version }}-SNAPSHOT
with:
gradle-version: 8.1.1
arguments: build

- name: Publish SNAPSHOT using Gradle
uses: gradle/gradle-build-action@v2.4.2
env:
LIB_VERSION: ${{ steps.gitsha.outputs.sha }}-SNAPSHOT
LIB_VERSION: ${{ steps.gitversion.outputs.version }}-SNAPSHOT
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
SIGNING_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/release_to_maven_central.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
name: Release to Maven Central

on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: true
default: '3.?.?'
on: [workflow_dispatch]

jobs:
buildpublish:
runs-on: ubuntu-latest
steps:
- run: echo "Releasing jSerialComm v${{ github.event.inputs.releaseversion }}"

- name: Check out source code
uses: actions/checkout@v3

- name: Get source code version number
id: gitversion
run: echo "version=$(grep -o "versionString = .*;" src/main/java/com/fazecast/jSerialComm/SerialPort.java | grep -o "\".*\"" | grep -o [^\"].*[^\"])" >> $GITHUB_OUTPUT

- name: Build native libraries using Docker toolchain
uses: addnab/docker-run-action@v3
with:
Expand All @@ -32,13 +28,16 @@ jobs:

- name: Build library using Gradle
uses: gradle/gradle-build-action@v2.4.2
env:
LIB_VERSION: ${{ steps.gitversion.outputs.version }}
with:
gradle-version: 8.1.1
arguments: build

- name: Publish library using Gradle
uses: gradle/gradle-build-action@v2.4.2
env:
LIB_VERSION: ${{ steps.gitversion.outputs.version }}
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
SIGNING_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
Expand All @@ -57,11 +56,11 @@ jobs:
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GRADLE_UPDATE_PAT }}
name: "jSerialComm v${{ github.event.inputs.releaseversion }}"
tag: "v${{ github.event.inputs.releaseversion }}"
name: "jSerialComm v${{ steps.gitversion.outputs.version }}"
tag: "v${{ steps.gitversion.outputs.version }}"
body: ${{ steps.changelog.outputs.changelog }}
commit: "master"
artifacts: "build/libs/jSerialComm-${{ github.event.inputs.releaseversion }}.jar"
artifacts: "build/libs/jSerialComm-${{ steps.gitversion.outputs.version }}.jar"
generateReleaseNotes: false
prerelease: false
makeLatest: true
Expand All @@ -72,7 +71,7 @@ jobs:
with:
ref: gh-pages
path: documentation
- run: rm -rf documentation/binaries/* documentation/javadoc && mv build/docs/javadoc documentation/ && sed -i "s/jSerialComm-[^j]*jar/jSerialComm-${{ github.event.inputs.releaseversion }}.jar/g" documentation/index.html
- run: rm -rf documentation/binaries/* documentation/javadoc && mv build/docs/javadoc documentation/ && sed -i "s/jSerialComm-[^j]*jar/jSerialComm-${{ steps.gitversion.outputs.version }}.jar/g" documentation/index.html

- name: Publish new library documentation
uses: s0/git-publish-subdir-action@v2.6.0
Expand All @@ -81,4 +80,4 @@ jobs:
BRANCH: gh-pages
FOLDER: documentation
GITHUB_TOKEN: ${{ secrets.GRADLE_UPDATE_PAT }}
MESSAGE: "Updated docs to v${{ github.event.inputs.releaseversion }}"
MESSAGE: "Updated docs to v${{ steps.gitversion.outputs.version }}"
4 changes: 2 additions & 2 deletions src/main/java/com/fazecast/jSerialComm/SerialPort.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* SerialPort.java
*
* Created on: Feb 25, 2012
* Last Updated on: Jun 19, 2023
* Last Updated on: Jun 27, 2023
* Author: Will Hedgecock
*
* Copyright (C) 2012-2023 Fazecast, Inc.
Expand Down Expand Up @@ -98,7 +98,7 @@ public class SerialPort

// Static initializer loads correct native library for this machine
static private final ReentrantLock lock = new ReentrantLock(true);
static private final String versionString = "2.10.0-beta4";
static private final String versionString = "2.10.0";
static private final String tmpdirAppIdProperty = "fazecast.jSerialComm.appid";
static private final List<Thread> shutdownHooks = new ArrayList<Thread>();
static private boolean isWindows = false, isAndroid = false;
Expand Down

0 comments on commit 0489369

Please sign in to comment.