diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc63283..64316eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: node-version: "" sbt-disk-cache: "false" cache-mode: save - cache-epoch: "" + cache-epoch: fe7dc0ac41a3d683 - name: cache-rehydrate run: sbt 'Test/compile' test: @@ -105,7 +105,7 @@ jobs: node-version: "" sbt-disk-cache: "false" cache-mode: save - cache-epoch: "" + cache-epoch: fe7dc0ac41a3d683 - name: Pinned snapshots run: echo "::warning title=zipx snapshots::pinned snapshots (rocks.earlyeffect:sbt-zipx:0.17.0-SNAPSHOT)" - name: test @@ -140,7 +140,7 @@ jobs: node-version: "" sbt-disk-cache: "false" cache-mode: restore - cache-epoch: "" + cache-epoch: fe7dc0ac41a3d683 - name: fmt run: | if [ "$ZIPX_VERIFY_CLEAN_FULL" = "true" ]; then @@ -173,7 +173,7 @@ jobs: node-version: "" sbt-disk-cache: "false" cache-mode: restore - cache-epoch: "" + cache-epoch: fe7dc0ac41a3d683 - name: workflow-check run: | if [ "$ZIPX_VERIFY_CLEAN_FULL" = "true" ]; then @@ -206,7 +206,7 @@ jobs: node-version: "" sbt-disk-cache: "false" cache-mode: restore - cache-epoch: "" + cache-epoch: fe7dc0ac41a3d683 - name: advisories run: | if [ "$ZIPX_VERIFY_CLEAN_FULL" = "true" ]; then @@ -216,6 +216,83 @@ jobs: fi env: ZIPX_VERIFY_CLEAN_FULL: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'clean') }} + modver-suggest: + name: modver-suggest + runs-on: ubuntu-latest + needs: + - verify-gate + if: (!cancelled() && !startsWith(github.ref, 'refs/tags/') && github.event_name != 'workflow_dispatch' && ((needs.verify-gate.result != 'success') || (needs.verify-gate.outputs.run == 'true'))) && (github.event_name == 'pull_request') + permissions: + contents: read + pull-requests: write + env: + COURSIER_TTL: "0s" + JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 + ZIPX_MODVER_BASE_SHA: ${{ github.event.pull_request.base.sha }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: "0" + fetch-tags: "true" + - name: zipx sbt setup + uses: ./.github/actions/zipx-sbt-setup + with: + java-version: "25" + runner-os: ubuntu-latest + cache-key-suffix: modver-suggest + node-version: "" + sbt-disk-cache: "false" + cache-mode: restore + cache-epoch: fe7dc0ac41a3d683 + - name: Fetch PR base SHA + run: git fetch --no-tags origin "$ZIPX_MODVER_BASE_SHA" + - name: modver-suggest + run: | + if [ "$ZIPX_VERIFY_CLEAN_FULL" = "true" ]; then + sbt 'cleanFull; zipxModverSuggest' + else + sbt 'zipxModverSuggest' + fi + env: + ZIPX_VERIFY_CLEAN_FULL: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'clean') }} + modver-check: + name: modver-check + runs-on: ubuntu-latest + needs: + - verify-gate + if: (!cancelled() && !startsWith(github.ref, 'refs/tags/') && github.event_name != 'workflow_dispatch' && ((needs.verify-gate.result != 'success') || (needs.verify-gate.outputs.run == 'true'))) && (github.event_name == 'pull_request') + permissions: + contents: read + env: + COURSIER_TTL: "0s" + JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 + ZIPX_MODVER_BASE_SHA: ${{ github.event.pull_request.base.sha }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: "0" + fetch-tags: "true" + - name: zipx sbt setup + uses: ./.github/actions/zipx-sbt-setup + with: + java-version: "25" + runner-os: ubuntu-latest + cache-key-suffix: modver-check + node-version: "" + sbt-disk-cache: "false" + cache-mode: restore + cache-epoch: fe7dc0ac41a3d683 + - name: Fetch PR base SHA + run: git fetch --no-tags origin "$ZIPX_MODVER_BASE_SHA" + - name: modver-check + run: | + if [ "$ZIPX_VERIFY_CLEAN_FULL" = "true" ]; then + sbt 'cleanFull; zipxModverCheck' + else + sbt 'zipxModverCheck' + fi + env: + ZIPX_VERIFY_CLEAN_FULL: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'clean') }} test-js: name: test-js runs-on: ubuntu-latest @@ -239,7 +316,7 @@ jobs: node-version: "" sbt-disk-cache: "false" cache-mode: restore - cache-epoch: "" + cache-epoch: fe7dc0ac41a3d683 - name: test-js run: | if [ "$ZIPX_VERIFY_CLEAN_FULL" = "true" ]; then @@ -272,7 +349,7 @@ jobs: node-version: "" sbt-disk-cache: "false" cache-mode: restore - cache-epoch: "" + cache-epoch: fe7dc0ac41a3d683 - name: Install Scala Native build dependencies run: sudo apt-get update && sudo apt-get install -y clang libstdc++-12-dev libgc-dev libunwind-dev libssl-dev - name: test-native @@ -284,15 +361,16 @@ jobs: fi env: ZIPX_VERIFY_CLEAN_FULL: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'clean') }} - publish: - name: publish + snapshots: + name: snapshots runs-on: ubuntu-latest - if: (startsWith(github.ref, 'refs/tags/v')) && (github.repository == 'early-effect/hexis') + needs: + - cache-rehydrate + - test + if: ((!cancelled() && needs.cache-rehydrate.result != 'failure' && needs.test.result != 'failure') && ((((github.event_name == 'push') && ((github.ref == 'refs/heads/main'))) || (github.event_name == 'workflow_dispatch')))) && (github.repository == 'early-effect/hexis') env: COURSIER_TTL: "0s" JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 - PGP_KEY_HEX: ${{ secrets.PGP_KEY_HEX }} - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} steps: @@ -305,22 +383,42 @@ jobs: with: java-version: "25" runner-os: ubuntu-latest - cache-key-suffix: publish + cache-key-suffix: snapshots node-version: "" sbt-disk-cache: "false" cache-mode: restore - cache-epoch: "" - - name: Import signing key - run: | - mkdir -p ~/.gnupg && chmod 700 ~/.gnupg - echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf - echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf - gpgconf --kill gpg-agent || true - echo "$PGP_SECRET" | base64 --decode | gpg --batch --import - env: - PGP_SECRET: ${{ secrets.PGP_SECRET }} - - name: publish - run: sbt 'hexis/publishSigned; hexisJS/publishSigned; hexisNative/publishSigned; sonaRelease' + cache-epoch: fe7dc0ac41a3d683 + - name: snapshots + run: sbt 'zipxSnapshotPublish' + snapshots-pr: + name: snapshots-pr + runs-on: ubuntu-latest + needs: + - cache-rehydrate + - test + if: (!cancelled() && needs.cache-rehydrate.result != 'failure' && needs.test.result != 'failure') && (((github.event_name == 'pull_request') && (contains(github.event.pull_request.labels.*.name, 'snapshots'))) && (github.event.pull_request.head.repo.full_name == github.repository)) + env: + COURSIER_TTL: "0s" + JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: "0" + fetch-tags: "true" + - name: zipx sbt setup + uses: ./.github/actions/zipx-sbt-setup + with: + java-version: "25" + runner-os: ubuntu-latest + cache-key-suffix: snapshots-pr + node-version: "" + sbt-disk-cache: "false" + cache-mode: restore + cache-epoch: fe7dc0ac41a3d683 + - name: snapshots-pr + run: sbt 'zipxSnapshotPublish pr' docs: name: docs if: ((startsWith(github.ref, 'refs/tags/v')) || (github.event_name == 'workflow_dispatch')) && (github.repository == 'early-effect/hexis') diff --git a/.github/workflows/zipx-release.yml b/.github/workflows/zipx-release.yml new file mode 100644 index 0000000..e02f102 --- /dev/null +++ b/.github/workflows/zipx-release.yml @@ -0,0 +1,107 @@ +# Generated by zipx. Do not edit. Run 'sbt zipxWorkflowGenerate' to regenerate. +name: zipx release +"on": + push: + tags: + - v* + workflow_dispatch: + inputs: + ships: + description: all, or comma-separated ship names (client, libs) + type: string + required: true + default: all +permissions: + contents: write +concurrency: + group: zipx-release + cancel-in-progress: false +jobs: + release: + name: release + runs-on: ubuntu-latest + if: github.event_name == 'push' || github.ref_name == github.event.repository.default_branch + environment: zipx-release + env: + COURSIER_TTL: "0s" + JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 + PGP_KEY_HEX: ${{ secrets.PGP_KEY_HEX }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: "0" + fetch-tags: "true" + - name: zipx sbt setup + uses: ./.github/actions/zipx-sbt-setup + with: + java-version: "25" + runner-os: ubuntu-latest + cache-key-suffix: release + node-version: "" + sbt-disk-cache: "false" + cache-mode: restore + cache-epoch: fe7dc0ac41a3d683 + - name: Tag is on the default branch + if: github.event_name == 'push' + run: | + set -euo pipefail + if ! git merge-base --is-ancestor "$GITHUB_SHA" "origin/$ZIPX_DEFAULT_BRANCH"; then + echo "::error title=zipx release::zipx: tag $GITHUB_REF_NAME is not on $ZIPX_DEFAULT_BRANCH" + exit 1 + fi + env: + ZIPX_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} + - name: Import signing key + run: | + mkdir -p ~/.gnupg && chmod 700 ~/.gnupg + echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf + echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf + gpgconf --kill gpg-agent || true + echo "$PGP_SECRET" | base64 --decode | gpg --batch --import + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + - name: Release request + run: | + set -euo pipefail + if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then + echo "ZIPX_RELEASE_REF=$ZIPX_SHIPS" >> "$GITHUB_ENV" + else + echo "ZIPX_RELEASE_REF=$GITHUB_REF" >> "$GITHUB_ENV" + fi + env: + ZIPX_SHIPS: ${{ inputs.ships }} + - name: Release + run: | + set -euo pipefail + sbt "zipxRelease $ZIPX_RELEASE_REF" + - name: Tag and publish GitHub Releases + if: github.event_name == 'workflow_dispatch' + run: | + set -euo pipefail + for tag in $(cat "target/zipx-release-tags.txt"); do + gh release create "$tag" --target "$GITHUB_SHA" --generate-notes + done + env: + GH_TOKEN: ${{ github.token }} + - name: Open the next snapshot + run: | + set -euo pipefail + echo "## Open the next snapshot" >> "$GITHUB_STEP_SUMMARY" + echo "These rows are released. Further snapshots of them publish nothing until the catalog moves." >> "$GITHUB_STEP_SUMMARY" + cat target/zipx-release-tags.txt >> "$GITHUB_STEP_SUMMARY" + echo "On this commit: sbt zipxModverBump" >> "$GITHUB_STEP_SUMMARY" + docs: + name: docs + needs: + - release + if: github.event_name == 'workflow_dispatch' + permissions: + contents: read + pages: write + id-token: write + uses: early-effect/.github/.github/workflows/specular-docs.yml@main + with: + sbt-project: docs diff --git a/project/HexisZipx.scala b/project/HexisZipx.scala index ffe6873..31dc918 100644 --- a/project/HexisZipx.scala +++ b/project/HexisZipx.scala @@ -66,8 +66,10 @@ object HexisZipx: extraSteps = nativeCiSetup, env = javaOpts, ), - ZipxCentral.release.withCondition(upstream), + ZipxCentral.snapshots.andCondition(upstream), + ZipxCentral.pullRequestSnapshots("snapshots"), ZipxDocs.pages().andCondition(upstream), ), + zipxReleaseWorkflow := Some(ZipxCentral.releases), ) end HexisZipx diff --git a/project/ZipxVersions.scala b/project/ZipxVersions.scala index 8a05def..1b11eb1 100644 --- a/project/ZipxVersions.scala +++ b/project/ZipxVersions.scala @@ -8,6 +8,8 @@ object MyVersions extends ZipxVersions: val sbt: SbtVersion = SbtVersion("2.1.0-M3") val scala: ScalaVersion = ScalaVersion("3.9.0") + val release = ShipGroup("hexis", "0.1.1")("hexis") + val zio = Lib("dev.zio", "zio", "2.1.26") val zioStreams = zio.mod("zio-streams") val zioTest = zio.mod("zio-test").test @@ -26,7 +28,6 @@ object MyVersions extends ZipxVersions: val ascentCss = ascentJs.mod("ascent-css") val scalafmt = Plugin("org.scalameta", "sbt-scalafmt", "2.6.2") - val dynver = Plugin("com.github.sbt", "sbt-dynver", "5.1.1") val scalajs = Plugin("org.scala-js", "sbt-scalajs", "1.22.0") val scalaNative = Plugin("org.scala-native", "sbt-scala-native", "0.5.12") val specularPlugin = Plugin("rocks.earlyeffect", "sbt-specular", "0.17.0") diff --git a/project/plugins.sbt b/project/plugins.sbt index c29b144..586a790 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,7 +3,6 @@ resolvers += "central-snapshots" at "https://central.sonatype.com/repository/mav forceUpdatePeriod := Some(scala.concurrent.duration.Duration.Zero) addSbtPlugin("rocks.earlyeffect" % "sbt-zipx" % "0.17.0-SNAPSHOT") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.6.2") -addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.1") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.22.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.12") addSbtPlugin("rocks.earlyeffect" % "sbt-specular" % "0.17.0")