Skip to content

Commit

Permalink
Setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Oct 29, 2023
1 parent 77f5f91 commit 48fcf68
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release
concurrency: ci-${{ github.ref }}
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: fregante/setup-git-user@v2
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17
- name: Capture Version
run: |
echo "captured_version=$(./gradlew printVersionName | grep -Po '(?<=GRADLE_VERSION=\()(.*)(?=\))')" >> "$GITHUB_ENV"
id: capture_version
- name: Set Version
uses: rickstaa/action-create-tag@v1
id: "tag_create"
with:
tag: ${{ env.captured_version }}
- uses: gradle/gradle-build-action@v2
with:
arguments: build publish
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/1.') }}
env:
MAVEN_USER: github
MAVEN_PASSWORD: ${{ secrets.RELEASE_MAVEN_PASSWORD }}
MAVEN_URL: https://maven.lukebemish.dev/releases/
34 changes: 33 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'java-gradle-plugin'
id 'maven-publish'
}

group = 'dev.lukebemish'
Expand All @@ -12,4 +13,35 @@ gradlePlugin {
implementationClass = 'dev.lukebemish.managedversioning.ManagedVersioningPlugin'
}
}
}
}

tasks.register('printVersionName') {
doLast{
project.exec {
commandLine 'echo', "GRADLE_VERSION=(${project.version})"
}
}
}

java.withSourcesJar()
java.withJavadocJar()
java.toolchain.languageVersion.set JavaLanguageVersion.of(17)

processResources {
from rootProject.file('LICENSE')
}

publishing {
repositories {
if (System.getenv('MAVEN_URL')) {
maven {
name = 'LukesMaven'
url = System.getenv('MAVEN_URL')
credentials {
username = System.getenv('MAVEN_USER') ?: ''
password = System.getenv('MAVEN_PASSWORD') ?: ''
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public abstract class ManagedVersioningExtension {

public ManagedVersioningExtension(Project project) {
this.project = project;
this.getGitWorkingDir().convention(project.getLayout().getProjectDirectory());
this.getStagedChangesVersionSuffix().convention("dirty");
this.getUnstagedChangesVersionSuffix().convention("dirty");
this.gitHash = project.getProviders().of(GitValueSource.class, spec -> {
Expand Down

0 comments on commit 48fcf68

Please sign in to comment.