Skip to content

Commit

Permalink
Support for CI + Publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilunni committed Oct 16, 2024
1 parent 6f6da90 commit 2234164
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 7 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and Publish

on: [push]

jobs:
test:
name: 'Build and Publish'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: '17'
- name: Run build
run: ./gradlew build
- name: Archive Tests Results
uses: actions/upload-artifact@v3
if: failure()
with:
name: Tests Results
path: "**/build/reports/tests/"
retention-days: 2
- name: Publish JVM
run: ./gradlew publish
if: github.ref == 'refs/heads/main'
env:
GITHUB_USERNAME: ${{secrets.GITHUB_ACTOR}}
GITHUB_PASSWORD: ${{secrets.GITHUB_TOKEN}}
- name: Publish NPM
run: ./gradlew publishJsPackageToGithubRegistry
if: github.ref == 'refs/heads/main'
env:
GITHUB_USERNAME: ${{secrets.GITHUB_ACTOR}}
GITHUB_PASSWORD: ${{secrets.GITHUB_TOKEN}}
36 changes: 29 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
kotlin("multiplatform") version "2.0.20"
id("maven-publish")
id("io.github.gciatto.kt-npm-publish") version "0.3.2"
id("dev.petuska.npm.publish") version "3.4.3"
}

group = "com.brainera"
version = "1.0-SNAPSHOT"
version = "0.0.1"

repositories {
mavenCentral()
Expand Down Expand Up @@ -58,11 +58,33 @@ kotlin {
}
}

npmPublishing {
token.set(System.getenv("NPM_AUTH_TOKEN"))
npmPublish {
registries {
register("github") {
uri.set("https://npm.pkg.github.com")
authToken.set(System.getenv("GITHUB_PASSWORD"))
}
}

liftPackageJson {
license = "Apache-2.0"
name = "@cortexapps/pseudonymizer"
packages {
named("js") {
packageJson {
license = "Apache-2.0"
name = "@cortexapps/pseudonymizer"
}
}
}
}

publishing {
repositories {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/cortexapps/pseudonymizer")
credentials {
username = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_PASSWORD")
}
}
}
}

0 comments on commit 2234164

Please sign in to comment.