diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23ef7e5..0f70a88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,8 @@ on: branches: ['**'] tags: [v*] +permissions: write-all + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -28,39 +30,28 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Java (adopt-hotspot@15.0.2+7) if: matrix.java == 'adopt-hotspot@15.0.2+7' - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: distribution: adopt-hotspot java-version: 15.0.2+7 - - - 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') }} + cache: sbt - name: Check that workflows are up to date - run: sbt ++${{ matrix.scala }} githubWorkflowCheck + run: sbt '++ ${{ matrix.scala }}' githubWorkflowCheck - - run: sbt ++${{ matrix.scala }} scalafmtCheckAll test scripted + - run: sbt '++ ${{ matrix.scala }}' scalafmtCheckAll test scripted - name: Compress target directories run: tar cf targets.tar target project/target - name: Upload target directories - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }} path: targets.tar @@ -77,31 +68,20 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Java (adopt-hotspot@15.0.2+7) if: matrix.java == 'adopt-hotspot@15.0.2+7' - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: distribution: adopt-hotspot java-version: 15.0.2+7 - - - 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') }} + cache: sbt - name: Download target directories (2.12.19) - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: target-${{ matrix.os }}-2.12.19-${{ matrix.java }} @@ -115,4 +95,4 @@ jobs: PGP_SECRET: ${{ secrets.PGP_SECRET }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - run: sbt ++${{ matrix.scala }} ci-release + run: sbt ci-release ghpagesPushSite diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml index 547aaa4..bfc865d 100644 --- a/.github/workflows/clean.yml +++ b/.github/workflows/clean.yml @@ -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 }} @@ -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 diff --git a/build.sbt b/build.sbt index 9c744bf..3439906 100644 --- a/build.sbt +++ b/build.sbt @@ -1,24 +1,24 @@ -import sbtghactions.JavaSpec +lazy val javas = List( + JavaSpec(JavaSpec.Distribution.Adopt, "15.0.2+7") +) inThisBuild( List( organization := "com.commercetools", homepage := Some(url("https://github.com/commercetools/scraml")), - licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), +licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), developers := List( - Developer( +Developer( "commercetools/priceless-backend-team", "Priceless Team", "priceless-backend@commercetools.com", url("https://commercetools.com") ) ), - githubWorkflowJavaVersions := Seq( - JavaSpec(JavaSpec.Distribution.Adopt, "15.0.2+7") - ), + githubWorkflowJavaVersions := javas, githubWorkflowPublish := Seq( WorkflowStep.Sbt( - List("ci-release"), + List("ci-release", "ghpagesPushSite"), env = Map( "PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}", "PGP_SECRET" -> "${{ secrets.PGP_SECRET }}", @@ -29,7 +29,8 @@ inThisBuild( ), githubWorkflowTargetTags ++= Seq("v*"), githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v"))), - githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("scalafmtCheckAll", "test", "scripted"))) + githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("scalafmtCheckAll", "test", "scripted"))), + githubWorkflowPermissions := Some(sbtghactions.Permissions.WriteAll) ) ) diff --git a/project/plugins.sbt b/project/plugins.sbt index 2b9b98e..7ab995b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0") -addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2") -addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.9.2") +addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.23.0") +addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.10.3") addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4") \ No newline at end of file