File tree 2 files changed +72
-14
lines changed
2 files changed +72
-14
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,51 @@ jobs:
111
111
tar xf targets.tar
112
112
rm targets.tar
113
113
114
- - run : sbt ++${{ matrix.scala }} ci-release
114
+ - id : release
115
+ run : sbt ++${{ matrix.scala }} ci-release
116
+
117
+ publish-native :
118
+ name : Publish native images
119
+ needs : [build]
120
+ if : github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
121
+ strategy :
122
+ matrix :
123
+ os : [macos-10.15]
124
+ scala : [3.1.0]
125
+
126
+ runs-on : ${{ matrix.os }}
127
+ steps :
128
+ - name : Checkout current branch (full)
129
+ uses : actions/checkout@v2
130
+ with :
131
+ fetch-depth : 0
132
+
133
+ - name : Setup Java and Scala
134
+ uses : olafurpg/setup-scala@v13
135
+ with :
136
+ java-version : ${{ matrix.java }}
137
+
138
+ - name : Cache sbt
139
+ uses : actions/cache@v2
140
+ with :
141
+ path : |
142
+ ~/.sbt
143
+ ~/.ivy2/cache
144
+ ~/.coursier/cache/v1
145
+ ~/.cache/coursier/v1
146
+ ~/AppData/Local/Coursier/Cache/v1
147
+ ~/Library/Caches/Coursier/v1
148
+ key : ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
149
+
150
+ - name : Download target directories (3.1.0)
151
+ uses : actions/download-artifact@v2
152
+ with :
153
+ name : target-${{ matrix.os }}-3.1.0-${{ matrix.java }}
154
+
155
+ - name : Inflate target directories (3.1.0)
156
+ run : |
157
+ tar xf targets.tar
158
+ rm targets.tar
115
159
116
160
- if : startsWith(github.ref, 'refs/tags/')
117
161
run : sbt ++${{ matrix.scala }} nativeImage
Original file line number Diff line number Diff line change @@ -26,24 +26,38 @@ ThisBuild / githubWorkflowOSes := Seq("macos-10.15")
26
26
27
27
ThisBuild / githubWorkflowPublish := Seq (
28
28
WorkflowStep .Sbt (
29
- List (" ci-release" )
30
- ),
31
- WorkflowStep .Sbt (
32
- List (" nativeImage" ),
33
- cond = Some (" startsWith(github.ref, 'refs/tags/')" )
34
- ),
35
- WorkflowStep .Use (
36
- UseRef .Public (" softprops" , " action-gh-release" , " v1" ),
37
- params = Map (" files" -> " target/native-image/spotify-next-${{ matrix.os }}" ),
38
- cond = Some (" startsWith(github.ref, 'refs/tags/')" )
29
+ List (" ci-release" ),
30
+ id = Some (" release" )
39
31
)
40
32
)
41
33
ThisBuild / githubWorkflowGeneratedCI ~= {
42
- _.map {
34
+ _.flatMap {
43
35
case job if job.id == " publish" =>
44
- job.copy(oses = List (" macos-10.15" ))
36
+ job.copy(oses = List (" macos-10.15" )) ::
37
+ job.copy(
38
+ id = " publish-native" ,
39
+ name = " Publish native images" ,
40
+ oses = List (" macos-10.15" ),
41
+ steps = job.steps.flatMap {
42
+ case step if step.id.contains(" release" ) =>
43
+ List (
44
+ WorkflowStep .Sbt (
45
+ List (" nativeImage" ),
46
+ cond = Some (" startsWith(github.ref, 'refs/tags/')" )
47
+ ),
48
+ WorkflowStep .Use (
49
+ UseRef .Public (" softprops" , " action-gh-release" , " v1" ),
50
+ params = Map (" files" -> " target/native-image/spotify-next-${{ matrix.os }}" ),
51
+ cond = Some (" startsWith(github.ref, 'refs/tags/')" )
52
+ )
53
+ )
54
+ case step =>
55
+ step :: Nil
56
+ }
57
+ ) ::
58
+ Nil
45
59
case job =>
46
- job
60
+ job :: Nil
47
61
}
48
62
}
49
63
You can’t perform that action at this time.
0 commit comments