This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy-geb.git
The following commit(s) were added to refs/heads/master by this push:
new a8db6a0b add logos to footer
a8db6a0b is described below
commit a8db6a0beac58b7a2e794cc56f8cbf7513c15893
Author: Paul King <[email protected]>
AuthorDate: Fri Feb 21 00:26:10 2025 +1000
add logos to footer
---
doc/site/public/images/asf_logo.png | Bin 0 -> 21243 bytes
doc/site/public/images/groovy-logo-white.png | Bin 0 -> 55066 bytes
doc/site/site.gradle | 112 ++++++++++++++++++++++++++-
doc/site/templates/main.html | 14 +++-
4 files changed, 122 insertions(+), 4 deletions(-)
diff --git a/doc/site/public/images/asf_logo.png
b/doc/site/public/images/asf_logo.png
new file mode 100644
index 00000000..b20bb7fa
Binary files /dev/null and b/doc/site/public/images/asf_logo.png differ
diff --git a/doc/site/public/images/groovy-logo-white.png
b/doc/site/public/images/groovy-logo-white.png
new file mode 100644
index 00000000..47921183
Binary files /dev/null and b/doc/site/public/images/groovy-logo-white.png differ
diff --git a/doc/site/site.gradle b/doc/site/site.gradle
index 887689a1..eeefcc3d 100644
--- a/doc/site/site.gradle
+++ b/doc/site/site.gradle
@@ -1,3 +1,5 @@
+import javax.inject.Inject
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,7 +21,8 @@
plugins {
id "geb.groovy-module"
id "geb.manuals"
- id("geb.spock-2-module")
+ id "geb.spock-2-module"
+ id 'org.ajoberstar.grgit' version '5.3.0' // to publish website to asf-git
branch
}
repositories {
mavenCentral()
@@ -159,4 +162,109 @@ tasks.register("generateDist", Copy) {
dependsOn("generatePublic")
}
build.dependsOn("generatePublic")
-build.dependsOn("generateDist")
\ No newline at end of file
+build.dependsOn("generateDist")
+
+def grgitClass = org.ajoberstar.grgit.Grgit
+def commitedChanges = false
+def gitboxUrl = project.findProperty('gitPublishRemote') ?:
'https://gitbox.apache.org/repos/asf/groovy-dev-site.git'
+def stagingDevSite =
project.layout.buildDirectory.dir('staging-dev-site').get().asFile
+def gebSite = project.layout.buildDirectory.dir('dist').get().asFile
+def gebTarget = new File(stagingDevSite, 'geb')
+
+// Creates a new commit on asf-site branch
+tasks.register('commitWebsite') {
+ dependsOn generateDist
+ def skipClone = project.hasProperty('skipClone')
+ doLast {
+ assert grgitClass : "git repository not found?"
+ assert file("$gebSite/index.html").exists()
+ // get the latest commit on master
+ def gitin = grgitClass.open(dir: rootProject.projectDir)
+ def latestCommit = gitin.log(maxCommits: 1)[0].abbreviatedId
+
+ def gitout
+ if (skipClone) {
+ gitout = grgitClass.open(dir: stagingDevSite)
+ } else {
+ println "Cloning $gitboxUrl to $stagingDevSite. This may take a
few minutes ..."
+ gitout = grgitClass.clone(dir: stagingDevSite, uri: gitboxUrl)
+ }
+
+ gitout.checkout(branch: 'asf-site')
+
+ // Delete the previous content. These are asf-site branch paths.
+ gitout.remove(patterns: ['geb'])
+ fileTree(gebTarget).visit { delete it.file }
+ assert !file("${gebTarget}/index.html").exists()
+
+ // Copy the built content and add it.
+ copy {
+ from gebSite
+ into gebTarget
+ }
+ assert file("${gebTarget}/index.html").exists()
+ gitout.add(patterns: ['geb'])
+ def removedFiles = gitout.status().unstaged.getRemoved()
+ if (removedFiles) {
+ gitout.remove(patterns: removedFiles)
+ }
+
+ if (!gitout.status().staged.getAllChanges()) {
+ println 'No changes to commit'
+ } else {
+ println 'Creating commit for changes'
+ def now = new Date().format('yyyy/MM/dd HH:mm:ss')
+ String message = "$now: Updated geb directory of dev website from
geb@$latestCommit"
+ commitedChanges = true
+ gitout.commit(message: message)
+ }
+ }
+}
+
+interface InjectedExecOps {
+ @Inject //@javax.inject.Inject
+ ExecOperations getExecOps()
+}
+
+/*
+ * Pushes the asf-site branch commits.
+ *
+ * This requires write access to the asf-site branch and can be run on
+ * Jenkins executors with the git-websites label.
+ *
+ * For more details on publishing, see:
+ * https://www.apache.org/dev/project-site.html
+ *
https://github.com/apache/infrastructure-puppet/blob/deployment/modules/gitwcsub/files/config/gitwcsub.cfg
+ *
+ * You can test this locally with a forked repository by manually adding the
+ * website-publish remote pointing to your forked repository, for example:
+ * git remote add website-publish
[email protected]:${GITUSER}/groovy-website.git
+ * because the remote is only added if it doesn't exist. The remote needs
+ * to be added before every execution of the publishing.
+ */
+tasks.register('publishWebsite') {
+ dependsOn commitWebsite
+ def injected = project.objects.newInstance(InjectedExecOps)
+ doLast {
+ assert grgit : "git repository not found?"
+
+ def git = grgit.open(dir: stagingDevSite)
+ git.checkout(branch: 'asf-site')
+ if (!commitedChanges) {
+ println 'No changes to push'
+ return
+ }
+
+ // Because git.push() fails to authenticate, run git push directly.
+ def cmd = 'git push origin asf-site'
+ def isWindows =
System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')
+ injected.execOps.exec {
+ workingDir stagingDevSite
+ if (isWindows) {
+ commandLine 'cmd.exe', '/c', cmd
+ } else {
+ commandLine 'sh', '-c', cmd
+ }
+ }
+ }
+}
diff --git a/doc/site/templates/main.html b/doc/site/templates/main.html
index 53601c43..77ae7712 100644
--- a/doc/site/templates/main.html
+++ b/doc/site/templates/main.html
@@ -510,8 +510,18 @@ class LoginSpec extends GebSpec {
</div>
<div class="ten wide column">
<h4 class="ui inverted header">About Geb</h4>
- <p>Geb is free, open source software licensed
under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html"
title="Apache License, Version 2.0">Apache License, Version 2.0</a>.
- Geb is a subproject of <a
href="https://groovy.apache.org">Apache Groovy</a>.</p>
+ <table><tr>
+ <td>
+ <p>Geb is free, open source software
licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html"
title="Apache License, Version 2.0">Apache License, Version 2.0</a>.
+ Geb is a subproject of <a
href="https://groovy.apache.org">Apache Groovy</a>.</p>
+ </td>
+ <td>
+ <a href="https://groovy.apache.org"><img
style="width:120px" alt="Groovy Logo" src="./images/groovy-logo-white.png"
class="offset-next"></a>
+ </td>
+ <td>
+ <a href="https://www.apache.org"><img
style="width:120px" alt="Apache Logo" src="./images/asf_logo.png"
class="offset-next"></a>
+ </td>
+ </tr></table>
</div>
</div>
</div>