@@ -34,7 +34,7 @@ ThisBuild / tlCiMimaBinaryIssueCheck := true
34
34
ThisBuild / tlCiDependencyGraphJob := true
35
35
ThisBuild / autoAPIMappings := true
36
36
37
- val sharedSettings = Seq (
37
+ val sharedSettings = Seq (
38
38
scalaVersion := " 3.5.2" ,
39
39
libraryDependencies ++= Seq (
40
40
" org.scalameta" %% " munit" % " 1.0.3" % Test
@@ -48,72 +48,139 @@ val sharedSettings = Seq(
48
48
|""" .stripMargin
49
49
))
50
50
)
51
-
52
- githubWorkflowGeneratedCI ++= Seq (
53
- WorkflowJob (
54
- id = " website" ,
55
- name = " 🌐 Publish website" ,
56
- oses = List (" ubuntu-latest" ),
57
- cond = Some (""" github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))""" ),
58
- needs = List (" publish" ),
59
- env = Map (" DTC_HEADLESS" -> " true" ),
60
- permissions = Some (Permissions .Specify .defaultPermissive),
61
- concurrency = Some (Concurrency (s " $$ {{ github.workflow }} @ $$ {{ github.ref }} " , Some (true ))),
62
- steps = List (
63
- WorkflowStep .Checkout ,
64
- WorkflowStep .Run (
65
- name = Some (" Setup" ),
66
- commands = List (" chmod +x dtcw" )
51
+ val releasePreparation = WorkflowJob (
52
+ id = " prepare-release" ,
53
+ name = " 👷 Prepare release" ,
54
+ oses = List (" ubuntu-latest" ),
55
+ cond = Some (""" github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))""" ),
56
+ needs = List (" build" ),
57
+ env = Map (" DTC_HEADLESS" -> " true" ),
58
+ permissions = Some (Permissions .Specify .defaultPermissive),
59
+ steps = List (
60
+ WorkflowStep .CheckoutFull ,
61
+ WorkflowStep .Run (
62
+ name = Some (" Get previous tag" ),
63
+ id = Some (" previousTag" ),
64
+ commands = List (
65
+ """ name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)""" ,
66
+ """ ref_name="${{ github.ref_name }}"""" ,
67
+ """ prefix="prepare-"""" ,
68
+ """ next_version=${ref_name/#$prefix}""" ,
69
+ """ echo "previousTag=$name"""" ,
70
+ """ echo "previousTag=$name" >> $GITHUB_ENV""" ,
71
+ """ echo "nextTag=$next_version"""" ,
72
+ """ echo "nextTag=$next_version" >> $GITHUB_ENV"""
73
+ )
74
+ ),
75
+ WorkflowStep .Use (
76
+ name = Some (" Update CHANGELOG" ),
77
+ id = Some (" changelog" ),
78
+ ref = UseRef .Public (" requarks" , " changelog-action" , " v1" ),
79
+ params = Map (
80
+ " token" -> " ${{ github.token }}" ,
81
+ " fromTag" -> " ${{ github.ref_name }}" ,
82
+ " toTag" -> " ${{ env.previousTag }}" ,
83
+ " writeToFile" -> " true"
84
+ )
85
+ ),
86
+ WorkflowStep .Use (
87
+ name = Some (" Commit CHANGELOG.md" ),
88
+ ref = UseRef .Public (" stefanzweifel" , " git-auto-commit-action" , " v5" ),
89
+ params = Map (
90
+ " commit_message" -> " docs: update CHANGELOG.md for ${{ env.nextTag }} [skip ci]" ,
91
+ " branch" -> " main" ,
92
+ " file_pattern" -> " CHANGELOG.md docToolchainConfig.groovy"
93
+ )
94
+ ),
95
+ WorkflowStep .Use (
96
+ name = Some (" Create version tag" ),
97
+ ref = UseRef .Public (" rickstaa" , " action-create-tag" , " v1" ),
98
+ params = Map (
99
+ " tag" -> " ${{ github.ref_name }}" ,
100
+ " message" -> " Release ${{ github.ref_name }}" ,
101
+ " force_push_tag" -> " true" // force push the tag to move it to HEAD
67
102
)
68
- ) ++
69
- WorkflowStep .SetupJava (List (JavaSpec .temurin(" 17" ))) ++
70
- List (
71
- WorkflowStep .Run (
72
- name = Some (" Install docToolchain" ),
73
- commands = List (" ./dtcw local install doctoolchain" )
74
- ),
75
- WorkflowStep .Use (
76
- name = Some (" Cache sbt" ),
77
- ref = UseRef .Public (" actions" , " cache" , " v4" ),
78
- params = Map (
79
- " path" ->
80
- """ .ivy2
81
- |.sbt""" .stripMargin,
82
- " key" -> s " sbt- $$ {{ hashFiles('build.sbt', 'plugins.sbt') }} " ,
83
- " restore-keys" -> s " pillars-cache- $$ {{ hashFiles('build.sbt', 'plugins.sbt') }} "
84
- )
85
- ),
86
- WorkflowStep .Run (
87
- name = Some (" Get latest version" ),
88
- id = Some (" version" ),
89
- commands = List (
90
- """ PILLARS_VERSION="$(git ls-remote --tags $REPO | awk -F"/" '{print $3}' | grep '^v[0-9]*\\ .[0-9]*\\ .[0-9]*' | grep -v {} | sort --version-sort | tail -n1)""" ,
91
- """ echo "latest version is [$PILLARS_VERSION]"""" ,
92
- """ echo "version=${PILLARS_VERSION#v}" >> "$GITHUB_OUTPUT""""
93
- )
94
- ),
95
- WorkflowStep .Run (
96
- name = Some (" Generate site" ),
97
- commands = List (""" ./dtcw local generateSite && sbt unidoc""" ),
98
- env = Map (" PILLARS_VERSION" -> " ${{ steps.version.outputs.version }}" , " DTC_HEADLESS" -> " true" )
99
- ),
100
- WorkflowStep .Run (
101
- name = Some (" Copy to public" ),
102
- commands = List (" cp -r target/microsite/output ./public" )
103
- ),
104
- WorkflowStep .Use (
105
- name = Some (" Deply to GitHub Pages" ),
106
- ref = UseRef .Public (" peaceiris" , " actions-gh-pages" , " v4" ),
107
- params = Map (
108
- " github_token" -> s " $$ {{ secrets.GITHUB_TOKEN }} " ,
109
- " publish_dir" -> " ./public" ,
110
- " cname" -> " pillars.dev" ,
111
- " enable_jekyll" -> " false"
112
- )
103
+ ),
104
+ WorkflowStep .Use (
105
+ name = Some (" Create release" ),
106
+ ref = UseRef .Public (" ncipollo" , " release-action" , " v1.14.0" ),
107
+ params = Map (
108
+ " allowUpdates" -> " true" ,
109
+ " draft" -> " false" ,
110
+ " makeLatest" -> " true" ,
111
+ " name" -> " ${{ env.nextTag }}" ,
112
+ " tag" -> " ${{ env.nextTag }}" ,
113
+ " body" -> " ${{ steps.changelog.outputs.changes }}" ,
114
+ " token" -> " ${{ github.token }}"
115
+ )
116
+ )
117
+ )
118
+ )
119
+ val websitePublication = WorkflowJob (
120
+ id = " website" ,
121
+ name = " 🌐 Publish website" ,
122
+ oses = List (" ubuntu-latest" ),
123
+ cond = Some (""" github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))""" ),
124
+ needs = List (" publish" ),
125
+ env = Map (" DTC_HEADLESS" -> " true" ),
126
+ permissions = Some (Permissions .Specify .defaultPermissive),
127
+ concurrency = Some (Concurrency (s " $$ {{ github.workflow }} @ $$ {{ github.ref }} " , Some (true ))),
128
+ steps = List (
129
+ WorkflowStep .Checkout ,
130
+ WorkflowStep .Run (
131
+ name = Some (" Setup" ),
132
+ commands = List (" chmod +x dtcw" )
133
+ )
134
+ ) ++
135
+ WorkflowStep .SetupJava (List (JavaSpec .temurin(" 17" ))) ++
136
+ List (
137
+ WorkflowStep .Run (
138
+ name = Some (" Install docToolchain" ),
139
+ commands = List (" ./dtcw local install doctoolchain" )
140
+ ),
141
+ WorkflowStep .Use (
142
+ name = Some (" Cache sbt" ),
143
+ ref = UseRef .Public (" actions" , " cache" , " v4" ),
144
+ params = Map (
145
+ " path" ->
146
+ """ .ivy2
147
+ |.sbt""" .stripMargin,
148
+ " key" -> s " sbt- $$ {{ hashFiles('build.sbt', 'plugins.sbt') }} " ,
149
+ " restore-keys" -> s " pillars-cache- $$ {{ hashFiles('build.sbt', 'plugins.sbt') }} "
150
+ )
151
+ ),
152
+ WorkflowStep .Run (
153
+ name = Some (" Get latest version" ),
154
+ id = Some (" version" ),
155
+ commands = List (
156
+ """ PILLARS_VERSION="$(git ls-remote --tags $REPO | awk -F"/" '{print $3}' | grep '^v[0-9]*\\ .[0-9]*\\ .[0-9]*' | grep -v {} | sort --version-sort | tail -n1)""" ,
157
+ """ echo "latest version is [$PILLARS_VERSION]"""" ,
158
+ """ echo "version=${PILLARS_VERSION#v}" >> "$GITHUB_OUTPUT""""
159
+ )
160
+ ),
161
+ WorkflowStep .Run (
162
+ name = Some (" Generate site" ),
163
+ commands = List (""" ./dtcw local generateSite && sbt unidoc""" ),
164
+ env = Map (" PILLARS_VERSION" -> " ${{ steps.version.outputs.version }}" , " DTC_HEADLESS" -> " true" )
165
+ ),
166
+ WorkflowStep .Run (
167
+ name = Some (" Copy to public" ),
168
+ commands = List (" cp -r target/microsite/output ./public" )
169
+ ),
170
+ WorkflowStep .Use (
171
+ name = Some (" Deply to GitHub Pages" ),
172
+ ref = UseRef .Public (" peaceiris" , " actions-gh-pages" , " v4" ),
173
+ params = Map (
174
+ " github_token" -> s " $$ {{ secrets.GITHUB_TOKEN }} " ,
175
+ " publish_dir" -> " ./public" ,
176
+ " cname" -> " pillars.dev" ,
177
+ " enable_jekyll" -> " false"
113
178
)
114
179
)
115
- )
180
+ )
116
181
)
182
+ ThisBuild / githubWorkflowGeneratedCI ++= List (releasePreparation, websitePublication)
183
+ ThisBuild / githubWorkflowPublishNeeds := List (" prepare-release" )
117
184
118
185
enablePlugins(ScalaUnidocPlugin )
119
186
0 commit comments