diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e0dbb2f..a5f0fd49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,9 @@ name: CI on: [push, pull_request] +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + jobs: build: strategy: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..afba125e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,45 @@ +name: publish + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +env: + PACKAGE_GITHUB_TOKEN: ${{ secrets.IAMPORT_COMMON }} + +jobs: + publish: + name: Build and Publish + strategy: + matrix: + os: [ ubuntu-latest ] + scala: [ 2.13.6 ] + java: [ openjdk@1.17.0 ] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v2 + + - name: Setup Java and Scala + uses: olafurpg/setup-scala@v13 + with: + java-version: ${{ matrix.java }} + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + ~/AppData/Local/Coursier/Cache/v1 + ~/Library/Caches/Coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + + - name: publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: sbt ++${{ matrix.scala }} publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 8dbba11c..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Release -on: - push: - branches: [master] - tags: ["*"] -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: actions/setup-node@v3 - with: - node-version: '16.x' - - name: Set up JDK 8 - uses: actions/setup-java@v3 - with: - java-version: 8 - distribution: temurin - cache: sbt - - name: Update docs - run: | - git config --global user.name "ZIO-gRPC Docs" - git config --global user.email "zio-grpc-docs@users.noreply.github.com" - eval "$(ssh-agent -s)" - echo "$TOKEN" | ssh-add - - sbt docs/mdoc - cd website - yarn install - yarn deploy - env: - TOKEN: ${{secrets.DEPLOY_KEY}} - USE_SSH: true - GIT_USER: git - - uses: olafurpg/setup-gpg@v3 - - name: Publish ${{ github.ref }} - run: sbt ci-release - env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} diff --git a/build.sbt b/build.sbt index 61c09f35..8f6d1fb7 100644 --- a/build.sbt +++ b/build.sbt @@ -13,14 +13,27 @@ ThisBuild / resolvers ++= Resolver.sonatypeOssRepos("snapshots") ThisBuild / versionScheme := Some("early-semver") -publish / skip := true +val commonPublishSettings = Seq( + credentials ++= Seq( + Credentials( + "GitHub Package Registry", + "maven.pkg.github.com", + scala.sys.env.getOrElse("GITHUB_ACTOR", ""), + scala.sys.env.getOrElse("GITHUB_TOKEN", "") + ) + ), + publishTo := Some( + "GitHub Package Registry (portone-io/zio-grpc)" at "https://maven.pkg.github.com/portone-io/zio-grpc" + ), + resolvers += "GitHub Package Registry (portone-io/zio-grpc)" at "https://maven.pkg.github.com/portone-io/zio-grpc" +) -sonatypeProfileName := "com.thesamet" +publish / skip := true inThisBuild( List( organization := "com.thesamet.scalapb.zio-grpc", - homepage := Some(url("https://github.com/scalapb/zio-grpc")), + homepage := Some(url("https://github.com/portone-io/zio-grpc")), licenses := List( "Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0") ), @@ -48,6 +61,7 @@ lazy val core = projectMatrix "dev.zio" %%% "zio-test-sbt" % Version.zio % "test" ) ) + .settings(commonPublishSettings) .jvmPlatform( ScalaVersions, Seq( @@ -83,6 +97,7 @@ lazy val codeGen = projectMatrix "com.thesamet.scalapb" %% "compilerplugin" % scalapb.compiler.Version.scalapbVersion ) ) + .settings(commonPublishSettings) .jvmPlatform(scalaVersions = ScalaVersions) lazy val codeGenJVM212 = codeGen.jvm(Scala212) @@ -98,6 +113,7 @@ lazy val protocGenZio = protocGenProject("protoc-gen-zio", codeGenJVM212) (assembly / assemblyMergeStrategy).value.apply(x) } ) + .settings(commonPublishSettings) lazy val e2eProtos = projectMatrix