From 67d6817f64bca2ee5239cc16ecd098f5a267557f Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sat, 5 Nov 2022 17:27:52 -0400 Subject: [PATCH] Add dev builds to maven --- .github/workflows/ci.yml | 21 +++++++++++++++++---- README.md | 3 ++- build.gradle | 1 + publish.gradle | 15 +++++++-------- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4adc216..112352c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: git config --global --add safe.directory /__w/navx-frc/navx-frc git fetch --prune --unshallow - name: Build with Gradle - run: ./gradlew build --max-workers 1 ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }} + run: ./gradlew build --max-workers 1 -PbuildServer ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }} - uses: actions/upload-artifact@v3 with: name: ${{ matrix.artifact-name }} @@ -70,7 +70,7 @@ jobs: shell: bash if: startsWith(github.ref, 'refs/tags/v') - name: Build with Gradle - run: ./gradlew build -Pbuildalldesktop ${{ env.EXTRA_GRADLE_ARGS }} + run: ./gradlew build -Pbuildalldesktop -PbuildServer ${{ env.EXTRA_GRADLE_ARGS }} - uses: actions/upload-artifact@v3 with: name: ${{ matrix.artifact-name }} @@ -110,9 +110,11 @@ jobs: name: Maven path: ~/releases - publish-maven-release: + publish-maven: + name: Publish to Maven if: | - github.repository_owner == 'rzblue' && startsWith(github.ref, 'refs/tags/v') + github.repository_owner == 'rzblue' && + (startsWith(github.ref, 'refs/tags/v') || github.ref_name == 'main') needs: combine runs-on: ubuntu-latest steps: @@ -125,6 +127,17 @@ jobs: with: name: Maven - name: Commit and push changes + if: | + github.ref_name == 'main' + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git commit -m "Add development build for ${{ github.sha }}" -m "CI Run ID: ${{ github.run_id }}" -m "CI Run Attempt: ${{ github.run_attempt }}" + git push + - name: Commit and push changes (Release) + if: | + startsWith(github.ref, 'refs/tags/v') run: | git config user.name 'github-actions[bot]' git config user.email 'github-actions[bot]@users.noreply.github.com' diff --git a/README.md b/README.md index 75a5bcb..2fc03ca 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ This is an *unofficial* repository containing source for the NavX FRC libraries for 2023. -Download the latest vendordep JSON on the [releases page](https://github.com/rzblue/navx-frc/releases) +Use this url to install the vendordep online: +`https://raw.githubusercontent.com/rzblue/navx-frc/maven/navx_frc.json` Caveats: diff --git a/build.gradle b/build.gradle index d8f9df0..c9484b5 100644 --- a/build.gradle +++ b/build.gradle @@ -5,6 +5,7 @@ plugins { id 'edu.wpi.first.wpilib.repositories.WPILibRepositoriesPlugin' version '2020.2' id 'edu.wpi.first.NativeUtils' version '2023.6.0' id 'edu.wpi.first.GradleVsCode' version '1.3.0' + id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '4.1.0' } repositories { diff --git a/publish.gradle b/publish.gradle index 186228d..3c70829 100644 --- a/publish.gradle +++ b/publish.gradle @@ -2,13 +2,13 @@ apply plugin: 'maven-publish' ext.licenseFile = files("$rootDir/LICENSE.txt") -def gitCommitHash = 'git rev-parse --verify --short HEAD'.execute().text.trim() -def baseVersion = '2023.1.0-beta-1' -def pubVersion = baseVersion -// This isn't what releaseMode is for - fix this later -if(!project.hasProperty("releaseMode")) { - pubVersion += "-" + gitCommitHash -} +wpilibVersioning.buildServerMode = project.hasProperty('buildServer') +wpilibVersioning.releaseMode = project.hasProperty('releaseMode') + +wpilibVersioning.useAllTags = true +wpilibVersioning.version.finalizeValue() + +def pubVersion = wpilibVersioning.version.get() def outputsFolder = file("$buildDir/outputs") @@ -139,7 +139,6 @@ def releasesRepoUrl = "$buildDir/repos/releases" publishing { repositories { maven { - url = releasesRepoUrl } }