Skip to content

Commit

Permalink
Delete manually crafted release.yml and integrate publishing through …
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinlfer committed Jun 5, 2023
1 parent 8ccf7e6 commit 3a0024c
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 26 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
branches: ['**']
push:
branches: ['**']
tags: [v*]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -61,3 +62,85 @@ jobs:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: Scala ${{ matrix.scala }}
run: sbt ++${{ matrix.scala }} coverageReport

- name: Compress target directories
run: tar cf targets.tar target core/target zio/target cats-effect/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
path: targets.tar

publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11

- 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: Download target directories (2.12.17)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.12.17-${{ matrix.java }}

- name: Inflate target directories (2.12.17)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.10)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.13.10-${{ matrix.java }}

- name: Inflate target directories (2.13.10)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.3.0)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-3.3.0-${{ matrix.java }}

- name: Inflate target directories (3.3.0)
run: |
tar xf targets.tar
rm targets.tar
- name: Publish project
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
run: sbt ++${{ matrix.scala }} ci-release
23 changes: 0 additions & 23 deletions .github/workflows/release.yml

This file was deleted.

22 changes: 19 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ inThisBuild {
val scala3 = "3.3.0"

List(
scalaVersion := scala213,
crossScalaVersions := Seq(scala212, scala213, scala3),
githubWorkflowPublishTargetBranches := Seq.empty,
scalaVersion := scala213,
crossScalaVersions := Seq(scala212, scala213, scala3),
githubWorkflowBuild := Seq(
WorkflowStep.Sbt(
name = Option("Build & Test"),
Expand All @@ -24,6 +23,23 @@ inThisBuild {
)
)
),
githubWorkflowTargetTags ++= Seq("v*"),
githubWorkflowPublishTargetBranches := Seq(
RefPredicate.StartsWith(Ref.Tag("v")),
RefPredicate.Equals(Ref.Branch("main"))
),
githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
commands = List("ci-release"),
name = Some("Publish project"),
env = Map(
"PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}",
"PGP_SECRET" -> "${{ secrets.PGP_SECRET }}",
"SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}",
"SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}"
)
)
),
testFrameworks ++= Seq(
new TestFramework("zio.test.sbt.ZTestFramework"),
new TestFramework("weaver.framework.CatsEffect")
Expand Down

0 comments on commit 3a0024c

Please sign in to comment.