diff --git a/.github/workflows/publish-without-test.yml b/.github/workflows/publish-without-test.yml new file mode 100644 index 0000000000..9cf69a2560 --- /dev/null +++ b/.github/workflows/publish-without-test.yml @@ -0,0 +1,17 @@ +name: Publish with Gradle +on: + push: + branches: + - master +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-java@v1 + with: + java-version: 11 + - name: Publish package + run: ./gradlew build publish -x test + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index ee85932d6e..521165991b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,22 +1,46 @@ plugins { - id 'java' - id 'idea' + id "java" + id "idea" + id "maven-publish" +} + +group = "com.rakovets.course" +version = "1.0.0" + +compileJava.options.encoding = "UTF-8" + +java { + withSourcesJar() + + toolchain { + languageVersion = JavaLanguageVersion.of(15) + } } repositories { mavenCentral() + jcenter() } dependencies { - testImplementation('org.junit.jupiter:junit-jupiter:5.5.2') + testImplementation("org.junit.jupiter:junit-jupiter:5.6.3") } -compileJava.options.encoding = 'UTF-8' -compileTestJava.options.encoding = 'UTF-8' -test { +test() { useJUnitPlatform() - testLogging { - events "passed", "skipped", "failed" + systemProperty("file.encoding", "UTF-8") +} + +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/rakovets/course-java-basics") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } } } diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000000..49d41d4702 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "course-java-basics"