Skip to content

Commit

Permalink
feat(publish): publish artifact to github packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Silthus committed May 8, 2020
1 parent d8bf926 commit 29afd59
Show file tree
Hide file tree
Showing 7 changed files with 5,443 additions and 7,840 deletions.
62 changes: 44 additions & 18 deletions .github/workflows/gradle.yml
Expand Up @@ -3,26 +3,14 @@ on: [push, pull_request]
jobs:
build:

runs-on: ubuntu-18.04
runs-on: [ubuntu-latest, windows-latest]

steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Set up Node.js v12.x
uses: actions/setup-node@v1
with:
node-version: "12.x"

- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache Gradle
id: cache-gradle
uses: actions/cache@v1
Expand All @@ -42,18 +30,56 @@ jobs:
with:
path: build/libs

- name: Upload CodeCov Report
uses: codecov/codecov-action@v1
with:
file: build/reports/jacoco/**/*.xml

- name: Upload Test Report
uses: actions/upload-artifact@v2
if: always()
with:
name: build reports
path: build/reports

release:
needs: [build]

runs-on: ubuntu-18.04

steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Set up Node.js v12.x
uses: actions/setup-node@v1
with:
node-version: "12.x"

- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache Gradle
id: cache-gradle
uses: actions/cache@v1
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle

- uses: actions/checkout@v1

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Release
run: |
npm install
npm run semantic-release
yarn install
yarn semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_artifactory_user: ${{ secrets.ARTIFACTORY_USER }}
ORG_GRADLE_PROJECT_artifactory_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions gradle/jacoco.gradle
@@ -1,3 +1,10 @@
jacoco { toolVersion = "0.8.2" }

jacocoTestReport {
reports {
xml.enabled true
html.enabled false
}
}

tasks.check.dependsOn 'jacocoTestReport'
16 changes: 4 additions & 12 deletions gradle/publish.gradle
Expand Up @@ -32,23 +32,15 @@ publishing {
publications {
mavenJava(MavenPublication) {
groupId = group
artifactId = packageName
from components.java
}
}
repositories {
maven {
def releasesRepoUrl = "${artifactory_contextUrl}/libs-release-local"
def snapshotsRepoUrl = "${artifactory_contextUrl}/libs-snapshot-local"
if (version.endsWith('SNAPSHOT')) {
url = snapshotsRepoUrl
} else {
url = releasesRepoUrl
}
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
def repo = System.getenv("GITHUB_REPOSITORY")
def githubOwner, githubRepo = repo != null ? repo.toLowerCase().tokenize("/") : "silthus/template"
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/${githubOwner}")
}
}
}
Expand Down

0 comments on commit 29afd59

Please sign in to comment.