在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):ajoberstar/gradle-git-publish开源软件地址(OpenSource Url):https://github.com/ajoberstar/gradle-git-publish开源编程语言(OpenSource Language):Java 51.6%开源软件介绍(OpenSource Introduction):gradle-git-publishProject NewsNewest versions are on Maven CentralAs of 3.0.1, gradle-git-publish is published to Maven Central. This project is no longer directly published to the Gradle Plugin Portal, but since the portal proxies Maven Central you can still access it through the portal. The only side effect is that the portal will no longer list the latest version. Use this repo or search.maven.org to find the latest version. Old versions from Bintray/JCenterThis project was previously uploaded to JCenter, which was deprecated in 2021. In the event that JCenter is unavailable and acess to past versions is needed, I've made a Maven repo available in bintray-backup. Add the following to your repositories to use it. maven {
name = 'ajoberstar-backup'
url = 'https://ajoberstar.org/bintray-backup/'
} Made possible by lacasseio/bintray-helper in case you have a similar need to pull your old Bintray artifacts. Why do you care?Git is immensely popular and being able to publish to it as part of a build process can be very valuable, for example to publish a blog or project documentation to GitHub Pages. What is it?
See Grgit for details on the Git library used underneath, including configuration for authentication. UsageSee the Release Notes for updates on changes and compatibility with Java and Gradle versions. Applying the Pluginplugins {
id 'org.ajoberstar.git-publish' version '<version>'
} ConfigurationNOTE: In general, there are no default values here. The main exception is that the gitPublish {
// where to publish to (repo must exist)
repoUri = '[email protected]:ajoberstar/test-repo.git'
// (or 'https://github.com/ajoberstar/test-repo.git', depending on authentication)
// where to fetch from prior to fetching from the remote (i.e. a local repo to save time)
referenceRepoUri = 'file:///home/human/projects/test-repo/'
// branch will be created if it doesn't exist
branch = 'gh-pages'
// generally, you don't need to touch this
repoDir = file("$buildDir/somewhereelse") // defaults to $buildDir/gitPublish
// what to publish, this is a standard CopySpec
contents {
from 'src/pages'
from(javadoc) {
into 'api'
}
}
// what to keep in the existing branch (include=keep)
preserve {
include '1.0.0/**'
exclude '1.0.0/temp.txt'
}
// message used when committing changes
commitMessage = 'Publishing a new page' // defaults to 'Generated by gradle-git-publish'
} As of v4.1.0, you can now configure multiple publications (e.g. to target different repositories or branches). gitPublish {
commitMessage = 'My favorite commit message' // configures the main publication
publications {
// main
main {
branch = 'great-branch' // alternatively can configure at the top-level of the gitPublish block
// ... any other config from the gitPublish block ...
}
other {
branch = 'some-branch' // may need branch.set('some-branch')
// ... any other config from the gitPublish block ...
}
}
} Tasks and ExecutionGenerally, you'll just run
Each publication gets its own set of tasks, with a general As is common in Gradle, the Avoiding Extra CopyIf you are generating a large site, you may want to directly generate it into the working repo to save an extra copy step. You can do this with task dependencies and referring to the jbakeTask {
outputDir gitPublish.repoDir
dependsOn gitPublishReset
}
gitPublishCommit.dependsOn jbakeTask Migrating from org.ajoberstar.github-pagesThe following table should help translate settings you used in
Use the Questions, Bugs, and FeaturesPlease use the repo's issues for all questions, bug reports, and feature requests. ContributingContributions are very welcome and are accepted through pull requests. Smaller changes can come directly as a PR, but larger or more complex ones should be discussed in an issue first to flesh out the approach. If you're interested in implementing a feature on the issues backlog, add a comment to make sure it's not already in progress and for any needed discussion. AcknowledgementsThanks to all of the contributors. I also want to acknowledge Peter Ledbrook for the initial idea and code for the plugin. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论