Skip to content

Commit

Permalink
Merge pull request #2 from snimavat/workflow-setup
Browse files Browse the repository at this point in the history
Workflow setup
  • Loading branch information
snimavat authored Sep 28, 2021
2 parents 63e46bc + fed3dbb commit 5c8e937
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 31 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build with gradle

on:
push:
branches:
- '*'
pull_request:
branches: [ 'master' ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: gradle
# - name: Grant execute permission for gradlew
# run: chmod +x gradlew
- name: Build with Gradle
run: gradle assemble
34 changes: 34 additions & 0 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Gradle Package

on:
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Gradle
run: gradle build

# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
run: gradle publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 15 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
plugins {
id "com.jfrog.bintray" version "1.7.3"
}

apply plugin: 'java'
apply plugin: "maven-publish"

sourceCompatibility = 1.8
group 'me.nimavat'
version '1.0.1.RC1'
version '1.0.1'

repositories {
mavenLocal()
Expand All @@ -20,42 +17,29 @@ task sourceJar(type: Jar) {
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/snimavat/shortid")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}

publications {
mavenJava(MavenPublication) { // Artifacts to publish
gpr(MavenPublication) {
// Artifacts to publish
from components.java
artifact sourceJar

groupId 'me.nimavat'
artifactId 'shortid'
version '1.0.1.RC1'
version '1.0.1'
}
}
}

bintray {
user = System.getenv("BINTRAY_USER") ?: project.bintrayUser
key = System.getenv("BINTRAY_KEY") ?: project.bintrayKey

publications = ['mavenJava']

pkg {
repo = 'maven'
name = 'shortid'
desc = 'Short id generator. Url-friendly. Non-predictable. Cluster-compatible.'
licenses = ['Apache-2.0']
publicDownloadNumbers = true

githubRepo = "snimavat/shortid"
githubReleaseNotesFile = 'README.md'
vcsUrl = 'https://github.com/snimavat/shortid'
issueTrackerUrl = 'https://github.com/snimavat/shortid/issues'

}

override = rootProject.version.endsWith("SNAPSHOT")
}

dependencies {
//testCompile group: 'junit', name: 'junit', version: '4.11'
}

0 comments on commit 5c8e937

Please sign in to comment.