1+ #
2+ # CI build that assembles artifacts and runs tests.
3+ # If validation is successful this workflow releases from the main dev branch.
4+ #
5+ # - skipping CI: add [skip ci] to the commit message
6+ # - skipping release: add [skip release] to the commit message
7+ #
8+ name : CI
9+
10+ on :
11+ push :
12+ branches : ['release/1.x']
13+ tags-ignore : [v*] # release tags are automatically generated after a successful CI build, no need to run CI against them
14+ pull_request :
15+ branches : ['**']
16+
17+ jobs :
18+
19+ #
20+ # Main build job
21+ #
22+ build :
23+ runs-on : ubuntu-latest
24+ if : " ! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
25+
26+ # Definition of the build matrix
27+ strategy :
28+ matrix :
29+ java : [8, 11]
30+
31+ # All build steps
32+ # SINGLE-MATRIX-JOB means that the step does not need to be executed on every job in the matrix
33+ steps :
34+
35+ - name : 1. Check out code
36+ 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
39+
40+ - name : 2. Set up Java ${{ matrix.java }}
41+ uses : actions/setup-java@v1
42+ with :
43+ java-version : ${{ matrix.java }}
44+
45+ - name : 3. Build on Java ${{ matrix.java }}
46+ run : ./gradlew build bintrayUpload --scan -PbintrayDryRun
47+
48+ #
49+ # Release job, only for pushes to the main development branch
50+ #
51+ release :
52+ runs-on : ubuntu-latest
53+ needs : [build] # build job must pass before we can release
54+
55+ if : github.event_name == 'push'
56+ && github.ref == 'refs/heads/release/1.x'
57+ && github.repository == 'mockito/mockito'
58+ && !contains(toJSON(github.event.commits.*.message), '[skip release]')
59+
60+ steps :
61+
62+ - name : Check out code
63+ uses : actions/checkout@v2 # https://github.com/actions/checkout
64+ with :
65+ fetch-depth : ' 0' # https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci
66+
67+ - name : Set up Java 8
68+ uses : actions/setup-java@v1
69+ with :
70+ java-version : 8
71+
72+ - name : Build and publish to Bintray/MavenCentral
73+ run : ./gradlew bintrayUpload githubRelease --scan
74+ env :
75+ MAVEN_CENTRAL_RELEASE : ${{contains(toJSON(github.event.commits.*.message), '[ci maven-central-release]')}}
76+ GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
77+ BINTRAY_API_KEY : ${{secrets.BINTRAY_API_KEY}}
78+ NEXUS_TOKEN_USER : ${{secrets.NEXUS_TOKEN_USER}}
79+ NEXUS_TOKEN_PWD : ${{secrets.NEXUS_TOKEN_PWD}}
0 commit comments