Skip to content

Commit 342ba93

Browse files
authored
Create releases on tags
Instead of releasing on every commit (in case of Dependabot, every dependency update is a new commit), we now use GitHub tags instead. This is similar to mockito-core, which also uses tags to determine when to release.
1 parent 425b3ed commit 342ba93

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: CI
1010
on:
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

@@ -34,14 +34,13 @@ jobs:
3434

3535
- name: 1. Check out code
3636
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
3937

4038
- name: 2. Set up Java ${{ matrix.java }}
4139
uses: actions/setup-java@v2
4240
with:
4341
distribution: 'zulu'
4442
java-version: ${{ matrix.java }}
43+
cache: 'gradle'
4544

4645
- name: 3. Build on Java ${{ matrix.java }}
4746
run: ./build.sh
@@ -57,11 +56,13 @@ jobs:
5756
# Release job, only for pushes to the main development branch
5857
#
5958
release:
59+
permissions:
60+
contents: write
6061
runs-on: ubuntu-latest
6162
needs: [build] # build job must pass before we can release
6263

6364
if: github.event_name == 'push'
64-
&& github.ref == 'refs/heads/release/2.x'
65+
&& (github.ref == 'refs/heads/release/2.x' || startsWith(github.ref, 'refs/tags/v'))
6566
&& github.repository == 'mockito/mockito-scala'
6667
&& !contains(toJSON(github.event.commits.*.message), '[skip release]')
6768

@@ -77,11 +78,10 @@ jobs:
7778
with:
7879
distribution: 'zulu'
7980
java-version: 17
81+
cache: 'gradle'
8082

8183
- name: Build and publish to Bintray/MavenCentral
82-
run: ./gradlew writeActualVersion
83-
&& export PROJECT_VERSION=`cat version.actual`
84-
&& ./build.sh
84+
run: ./build.sh
8585
&& ./gradlew publishToSonatype githubRelease closeAndReleaseStagingRepository releaseSummary
8686
env:
8787
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ nexusPublishing {
8585
}
8686
}
8787

88-
task writeActualVersion {
89-
doLast {
90-
file("version.actual") << "$version"
91-
}
92-
}
93-
9488
def isSnapshot = version.endsWith("-SNAPSHOT")
9589

9690
if (isSnapshot) {

version.properties

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)