Skip to content

Commit

Permalink
env: add publish workflow for GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rakovets committed Dec 20, 2020
1 parent da2792c commit 1592b4a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/publish-without-test.yml
Original file line number Diff line number Diff line change
@@ -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 }}
40 changes: 32 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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")
}
}
}
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "course-java-basics"

0 comments on commit 1592b4a

Please sign in to comment.