diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd1bf161..89351e41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,10 +10,13 @@ name: CI on: push: branches: ['release/2.x'] - tags-ignore: [v*] # release tags are automatically generated after a successful CI build, no need to run CI against them + tags: [v*] pull_request: branches: ['**'] +permissions: + contents: read + jobs: # @@ -34,8 +37,6 @@ jobs: - name: 1. Check out code uses: actions/checkout@v2 # https://github.com/actions/checkout - with: - fetch-depth: '0' # https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci - name: 2. Set up Java ${{ matrix.java }} uses: actions/setup-java@v2 @@ -57,11 +58,13 @@ jobs: # Release job, only for pushes to the main development branch # release: + permissions: + contents: write runs-on: ubuntu-latest needs: [build] # build job must pass before we can release if: github.event_name == 'push' - && github.ref == 'refs/heads/release/2.x' + && (github.ref == 'refs/heads/release/2.x' || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'mockito/mockito-scala' && !contains(toJSON(github.event.commits.*.message), '[skip release]') @@ -79,9 +82,7 @@ jobs: java-version: 17 - name: Build and publish to Bintray/MavenCentral - run: ./gradlew writeActualVersion - && export PROJECT_VERSION=`cat version.actual` - && ./build.sh + run: ./build.sh && ./gradlew publishToSonatype githubRelease closeAndReleaseStagingRepository releaseSummary env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/build.gradle b/build.gradle index 51a3dbd8..95a5e4b4 100644 --- a/build.gradle +++ b/build.gradle @@ -85,12 +85,6 @@ nexusPublishing { } } -task writeActualVersion { - doLast { - file("version.actual") << "$version" - } -} - def isSnapshot = version.endsWith("-SNAPSHOT") if (isSnapshot) { diff --git a/build.sbt b/build.sbt index 95a026c0..e201a9b7 100644 --- a/build.sbt +++ b/build.sbt @@ -7,18 +7,6 @@ val currentScalaVersion = "2.13.16" inThisBuild( Seq( scalaVersion := currentScalaVersion, - // Load version from the file so that Gradle/Shipkit and SBT use the same version - version := sys.env - .get("PROJECT_VERSION") - .filter(_.trim.nonEmpty) - .orElse { - lazy val VersionRE = """^version=(.+)$""".r - Using.file(Source.fromFile)(baseDirectory.value / "version.properties") { - _.getLines.collectFirst { case VersionRE(v) => v } - } - } - .map(_.replace(".*", "-SNAPSHOT")) - .get ) ) diff --git a/version.properties b/version.properties deleted file mode 100644 index bd7ddf43..00000000 --- a/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -# The version is inferred by shipkit-auto-version Gradle plugin -# More: https://github.com/shipkit/shipkit-auto-version -version=2.0.* \ No newline at end of file