File tree Expand file tree Collapse file tree 4 files changed +8
-28
lines changed Expand file tree Collapse file tree 4 files changed +8
-28
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,13 @@ name: CI
1010on :
1111  push :
1212    branches : ['release/2.x'] 
13-     tags-ignore  : [v*]   #  release tags are automatically generated after a successful CI build, no need to run CI against them 
13+     tags : [v*] 
1414  pull_request :
1515    branches : ['**'] 
1616
17+ permissions :
18+   contents : read 
19+ 
1720jobs :
1821
1922  # 
3437
3538      - name : 1. Check out code 
3639        uses : actions/checkout@v2  #  https://github.com/actions/checkout
37-         with :
38-           fetch-depth : ' 0'   #  https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci
3940
4041      - name : 2. Set up Java ${{ matrix.java }} 
4142        uses : actions/setup-java@v2 
@@ -57,11 +58,13 @@ jobs:
5758  #  Release job, only for pushes to the main development branch
5859  # 
5960  release :
61+     permissions :
62+       contents : write 
6063    runs-on : ubuntu-latest 
6164    needs : [build]  #  build job must pass before we can release
6265
6366    if : github.event_name == 'push' 
64-       && github.ref == 'refs/heads/release/2.x' 
67+       && ( github.ref == 'refs/heads/release/2.x' || startsWith(github.ref, 'refs/tags/v'))  
6568      && github.repository == 'mockito/mockito-scala' 
6669      && !contains(toJSON(github.event.commits.*.message), '[skip release]') 
6770
7982          java-version : 17 
8083
8184      - name : Build and publish to Bintray/MavenCentral 
82-         run : ./gradlew writeActualVersion 
83-           && export PROJECT_VERSION=`cat version.actual` 
84-           && ./build.sh 
85+         run : ./build.sh 
8586          && ./gradlew publishToSonatype githubRelease closeAndReleaseStagingRepository releaseSummary 
8687        env :
8788          GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}} 
Original file line number Diff line number Diff line change @@ -85,12 +85,6 @@ nexusPublishing {
8585    }
8686}
8787
88- task writeActualVersion  {
89-     doLast {
90-         file(" version.actual"  ) <<  " $version  " 
91-     }
92- }
93- 
9488def  isSnapshot =  version. endsWith(" -SNAPSHOT"  )
9589
9690if  (isSnapshot) {
Original file line number Diff line number Diff line change @@ -7,18 +7,6 @@ val currentScalaVersion = "2.13.16"
77inThisBuild(
88  Seq (
99    scalaVersion :=  currentScalaVersion,
10-     //  Load version from the file so that Gradle/Shipkit and SBT use the same version
11-     version :=  sys.env
12-       .get(" PROJECT_VERSION"  )
13-       .filter(_.trim.nonEmpty)
14-       .orElse {
15-         lazy  val  VersionRE  =  """ ^version=(.+)$"""  .r
16-         Using .file(Source .fromFile)(baseDirectory.value /  " version.properties"  ) {
17-           _.getLines.collectFirst { case  VersionRE (v) =>  v }
18-         }
19-       }
20-       .map(_.replace(" .*"  , " -SNAPSHOT"  ))
21-       .get
2210  )
2311)
2412
  Load Diff This file was deleted. 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments