77 tags : [v*]
88jobs :
99 ci :
10- # run on external PRs, but not on internal PRs since those will be run by push to branch
11- if : github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
12- runs-on : ubuntu-20.04
10+ # run on 1) push, 2) external PRs, 3) softwaremill-ci PRs
11+ # do not run on internal, non-steward PRs since those will be run by push to branch
12+ if : |
13+ github.event_name == 'push' ||
14+ github.event.pull_request.head.repo.full_name != github.repository ||
15+ github.event.pull_request.user.login == 'softwaremill-ci'
16+ runs-on : ubuntu-22.04
1317 strategy :
1418 matrix :
15- java : [ '8 ', '11 ', '17 ' ]
19+ java : [ '11 ', '17 ', '21 ' ]
1620 fail-fast : false
1721 steps :
18- - name : Set environment variables for Java 8
19- if : matrix.java == '8'
20- run : echo 'JAVA_OPTS=-Xmx5G' >> $GITHUB_ENV
21- - name : Set environment variables for Java 9+
22- if : matrix.java != '8'
22+ - name : Set environment variables for Java
2323 run : echo 'JAVA_OPTS=-Xmx5G --add-opens java.base/java.lang=ALL-UNNAMED' >> $GITHUB_ENV
2424 - name : Checkout
25- uses : actions/checkout@v2
25+ uses : actions/checkout@v4
2626 - name : Set up JDK
27- uses : actions/setup-java@v2
27+ uses : actions/setup-java@v4
2828 with :
29- distribution : ' adopt '
29+ distribution : ' zulu '
3030 java-version : ${{ matrix.java }}
31- - name : Cache sbt
32- uses : actions/cache@v2
33- with :
34- path : |
35- ~/.sbt
36- ~/.ivy2/cache
37- ~/.coursier
38- key : sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }}-${{ matrix.java }}
31+ cache : ' sbt'
3932 - name : Compile
4033 run : sbt -v compile
4134 - name : Test
4235 run : sbt -v test
43- - name : Cleanup
44- run : |
45- rm -rf "$HOME/.ivy2/local" || true
46- find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
47- find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true
48- find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
49- find $HOME/.sbt -name "*.lock" -delete || true
5036
5137 publish :
5238 name : Publish release
5339 needs : [ci]
5440 if : github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
55- runs-on : ubuntu-20 .04
41+ runs-on : ubuntu-22 .04
5642 env :
5743 JAVA_OPTS : -Xmx5G
5844 steps :
5945 - name : Checkout
60- uses : actions/checkout@v2
61- - name : Set up JDK 11
62- uses : actions/setup-java@v1
63- with :
64- java-version : 11
65- - name : Cache sbt
66- uses : actions/cache@v2
46+ uses : actions/checkout@v4
47+ - name : Set up JDK 17
48+ uses : actions/setup-java@v4
6749 with :
68- path : |
69- ~/.sbt
70- ~/.ivy2/cache
71- ~/.coursier
72- key : sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }}
50+ distribution : ' zulu'
51+ java-version : ' 17'
52+ cache : ' sbt'
7353 - name : Compile
7454 run : sbt compile
7555 - name : Publish artifacts
@@ -95,10 +75,41 @@ jobs:
9575 version : " v${{ env.VERSION }}"
9676 env :
9777 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
98- - name : Cleanup
78+
79+ # `automerge` label is attached iff there is exactly one file changed by steward and this file belongs to a
80+ # whitelist specified by `labeler.yml`
81+ label :
82+ name : Attach automerge label
83+ # only for PRs by softwaremill-ci
84+ if : github.event.pull_request.user.login == 'softwaremill-ci'
85+ runs-on : ubuntu-22.04
86+ steps :
87+ - uses : actions/checkout@v4
88+ with :
89+ fetch-depth : 2
90+ # count number of files changed
91+ - name : Count number of files changed
92+ id : count-changed-files
9993 run : |
100- rm -rf "$HOME/.ivy2/local" || true
101- find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
102- find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true
103- find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
104- find $HOME/.sbt -name "*.lock" -delete || true
94+ N=$(git diff --name-only -r HEAD^1 HEAD | wc -w)
95+ echo "changed_files_num=$N" >> $GITHUB_OUTPUT
96+ - name : Launch labeler
97+ # skip if more than one file changed
98+ if : steps.count-changed-files.outputs.changed_files_num == 1
99+ uses : srvaroa/labeler@master
100+ env :
101+ GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
102+
103+ auto-merge :
104+ name : Auto merge
105+ # only for PRs by softwaremill-ci
106+ if : github.event.pull_request.user.login == 'softwaremill-ci'
107+ needs : [ ci, label ]
108+ runs-on : ubuntu-22.04
109+ steps :
110+ - id : automerge
111+ name : automerge
112+ uses :
" pascalgn/[email protected] " 113+ env :
114+ GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
115+ MERGE_METHOD : " squash"
0 commit comments