Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

334 - publish artifacts #335

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 38 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ on:
tags: [v*]

env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
Expand All @@ -27,25 +23,28 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.3.3, 2.13.11, 2.12.18]
java: [graal_22.3.2@17]
scala: [3.3.4, 2.13.15, 2.12.20]
java: [graal_graalvm@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup GraalVM (graal_22.3.2@17)
if: matrix.java == 'graal_22.3.2@17'
- name: Setup GraalVM (graal_graalvm@17)
if: matrix.java == 'graal_graalvm@17'
uses: graalvm/setup-graalvm@v1
with:
version: 22.3.2
java-version: 17
distribution: graalvm
components: native-image
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: sbt

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Start containers
run: |
chmod -R 777 ./ftp-home/
Expand All @@ -61,7 +60,7 @@ jobs:
run: tar cf targets.tar target project/target

- name: Upload target directories
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
path: targets.tar
Expand All @@ -73,55 +72,62 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.3.3]
java: [graal_22.3.2@17]
scala: [3.3.4]
java: [graal_graalvm@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup GraalVM (graal_22.3.2@17)
if: matrix.java == 'graal_22.3.2@17'
- name: Setup GraalVM (graal_graalvm@17)
if: matrix.java == 'graal_graalvm@17'
uses: graalvm/setup-graalvm@v1
with:
version: 22.3.2
java-version: 17
distribution: graalvm
components: native-image
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: sbt

- name: Download target directories (3.3.3)
uses: actions/download-artifact@v3
- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Download target directories (3.3.4)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-3.3.3-${{ matrix.java }}
name: target-${{ matrix.os }}-3.3.4-${{ matrix.java }}

- name: Inflate target directories (3.3.3)
- name: Inflate target directories (3.3.4)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.13.11)
uses: actions/download-artifact@v3
- name: Download target directories (2.13.15)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-2.13.11-${{ matrix.java }}
name: target-${{ matrix.os }}-2.13.15-${{ matrix.java }}

- name: Inflate target directories (2.13.11)
- name: Inflate target directories (2.13.15)
run: |
tar xf targets.tar
rm targets.tar

- name: Download target directories (2.12.18)
uses: actions/download-artifact@v3
- name: Download target directories (2.12.20)
uses: actions/download-artifact@v4
with:
name: target-${{ matrix.os }}-2.12.18-${{ matrix.java }}
name: target-${{ matrix.os }}-2.12.20-${{ matrix.java }}

- name: Inflate target directories (2.12.18)
- name: Inflate target directories (2.12.20)
run: |
tar xf targets.tar
rm targets.tar

- uses: olafurpg/setup-gpg@v3

- run: sbt ci-release
- 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 ci-release
3 changes: 2 additions & 1 deletion .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Delete artifacts
shell: bash {0}
run: |
# Customize those three lines with your repository and credentials:
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
Expand All @@ -25,7 +26,7 @@ jobs:
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
# A temporary file which receives HTTP response headers.
TMPFILE=/tmp/tmp.$$
TMPFILE=$(mktemp)
# An associative array, key: artifact name, value: number of artifacts of that name.
declare -A ARTCOUNT
Expand Down
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,38 @@ pub rsa4096 2018-08-22 [SC]
uid [ultimate] your name <[email protected]>
sub rsa4096 2018-08-22 [E]

$>LONG_ID=1234517530FB96F147C6A146A326F592D39AAAAA

#send key to server
$> gpg --keyserver keyserver.ubuntu.com --send-keys $LONG_ID
$> gpg --keyserver hkp://keyserver.ubuntu.com --send-key $LONG_ID && \
gpg --keyserver hkp://pgp.mit.edu --send-key $LONG_ID && \
gpg --keyserver hkp://pool.sks-keyservers.net --send-key $LONG_ID




```

# declare in travis (settings) PGP_SECRET in base64 (with no return carriage), dont put "" around the value !
2. Github secrets

declare in github / repo / settings / secrets (new repository secret)

```
# PGP_SECRET in base64 (with no return carriage), dont put "" around the value !
gpg --armor --export-secret-keys $LONG_ID | base64 -w0 | pbcopy

# declare in travis (settings) PGP_PASSPHRASE in plain text
# declare in github (settings) PGP_PASSPHRASE in plain text
The randomly generated password you used to create a fresh gpg key


# declare in github (settings) SONATYPE_PASSWORD in plain text
The password you use to log into https://s01.oss.sonatype.org/ (or https://oss.sonatype.org/ if your Sonatype account was created before February 2021).
***IMPORTANT*** Login s01.oss.sonatype.org and after profile, and select "User token"
Alternatively, the password part of the user token if you generated one above.

# declare in github (settings) SONATYPE_USERNAME in plain text
***IMPORTANT*** Login s01.oss.sonatype.org, got to profile, and select "User token"
Alternatively, the username part of the user token if you generated one above.
```

2. create a tag and push
Expand Down
46 changes: 24 additions & 22 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
lazy val scala212 = "2.12.18"
lazy val scala213 = "2.13.11"
lazy val scala330 = "3.3.3"
lazy val scala212 = "2.12.20"
lazy val scala213 = "2.13.15"
lazy val scala330 = "3.3.4"

val fs2Version = "3.8.0"
val fs2Version = "3.11.0"

inThisBuild(
List(
Expand All @@ -17,7 +17,7 @@ inThisBuild(
)
ThisBuild / scalaVersion := scala330
ThisBuild / crossScalaVersions := List(scala330, scala213, scala212)
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.graalvm("22.3.2", "17"))
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.graalvm(Graalvm.Distribution("graalvm"), "17"))
ThisBuild / versionScheme := Some("early-semver")

ThisBuild / githubWorkflowBuildPreamble ++= Seq(
Expand All @@ -30,27 +30,29 @@ ThisBuild / githubWorkflowBuildPreamble ++= Seq(
name = Some("Start containers")
)
)

ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(List("check", "test"))
)

//sbt-ci-release settings
ThisBuild / githubWorkflowPublishPreamble := Seq(
WorkflowStep.Use(UseRef.Public("olafurpg", "setup-gpg", "v3"))
)

ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches := Seq(
RefPredicate.StartsWith(Ref.Branch("master")),
RefPredicate.StartsWith(Ref.Tag("v"))
)
ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("ci-release")))
ThisBuild / githubWorkflowEnv ++= List(
"PGP_PASSPHRASE",
"PGP_SECRET",
"SONATYPE_PASSWORD",
"SONATYPE_USERNAME"
).map(envKey => envKey -> s"$${{ secrets.$envKey }}").toMap

ThisBuild / 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 }}"
)
)
)

lazy val `fs2-ftp` = project
.in(file("."))
Expand Down Expand Up @@ -80,13 +82,13 @@ lazy val `fs2-ftp` = project
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % fs2Version,
"co.fs2" %% "fs2-io" % fs2Version,
"org.scala-lang.modules" %% "scala-collection-compat" % "2.11.0",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0",
"com.hierynomus" % "sshj" % "0.39.0",
"commons-net" % "commons-net" % "3.11.1",
"org.apache.logging.log4j" % "log4j-api" % "2.20.0" % Test,
"org.apache.logging.log4j" % "log4j-core" % "2.20.0" % Test,
"org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.20.0" % Test,
"org.scalatest" %% "scalatest" % "3.2.15" % Test
"org.apache.logging.log4j" % "log4j-api" % "2.23.1" % Test,
"org.apache.logging.log4j" % "log4j-core" % "2.23.1" % Test,
"org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.23.1" % Test,
"org.scalatest" %% "scalatest" % "3.2.19" % Test
)
)

Expand Down
6 changes: 3 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.15.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.7.0")
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.24.0")