Closed tiwanari closed 7 years ago
I don't know this magical things but seems ok. Did you test this?
Yes, I tested the procedure with my forked repository and it worked. But, strictly speaking, I haven't tested this PR because the secure
was newly created for this repository. I hope it works properly 🙏
I copied the script and the changes on .travis.yml
for this PR, and made a new personal access token
on my https://github.com/settings/tokens page by checking only Access public repositories
.
After getting the token, I ran the following command for this repository:
travis encrypt -r PileProject/drivecommand "GH_TOKEN=TOKEN" --add
and this added some lines into .travis.yml
automatically. The result is this PR.
By the way, I'm not sure whether master
branch should have release directory. And, I found it now diversed from gh-pages
branch's release directory. What do you think? :)
Ah, I remembered that the uploadArchives task refers to the existing releases by checking maven metadata file. So, at least we should keep the file in master and keep (restore) the consistence.
Hey @makotoshimazu @myusak
Please give me comments or approvals:) I want to merge this and make v2.2.0
before merging #23 and making v2.3.0
tag for that.
I had a detailed look on your changes and now I have a few questions and comments.
Questions:
$TRAVIS_TAG
?
Is it already defined in Travis?Comments:
I investigated build.gradle
and I found a way to specify uploadArchives.repositories.mavenDeployers.pom.version
via command line arguments.
If you have time please change your script (L26) and then we don't have to change build.gradle
per our release.
With my diff, the artifacts can be generated by ./gradlew deploy -Ptag=$TAG
diff --git a/build.gradle b/build.gradle
index a2bc4b0..c8b36ab 100644
--- a/build.gradle
+++ b/build.gradle
@@ -44,10 +44,6 @@ dependencies {
}
-task wraper(type: Wrapper) {
gradleVersion = '2.5' -}
// for our license license { header rootProject.file('LICENSE') @@ -55,26 +51,37 @@ license { }
// Maven repository identity setting -uploadArchives {
repositories {
mavenDeployer {
repository url: "file:${projectDir}"
pom.version = '2.1.0'
pom.groupId = 'com.pileproject'
pom.artifactId = 'drivecommand' +uploadArchives.repositories.mavenDeployer {
repository url: "file:${projectDir}"
pom {
version = 'unspecified'
groupId = 'com.pileproject'
artifactId = 'drivecommand'
pom.project {
inceptionYear '2011'
packaging 'jar'
licenses {
license {
name 'The Apache Software License, Version 2.0'
distribution 'repo'
}
project {
inceptionYear '2011'
packaging 'jar'
licenses {
license {
name 'The Apache Software License, Version 2.0'
distribution 'repo' } } } } }
+task deploy {
description = "Deploys current sourceset into .jar file via 'uploadArchives' task."
doLast {
if (!project.hasProperty('tag')) {
throw new GradleException('Tag not specified. Run with -Ptag=$TAG')
}
uploadArchives.repositories.mavenDeployer.pom.version = project.tag
uploadArchives.execute()
} +}
Now we can publish GitHub pages via /docs
directory in master
branch
https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/
So your script could be simplified because we don't have to deal with chaining branches.
Hi @myusak
I fixed scripts and tested them:)
Thanks to your valuable comments, the procedure becomes much simpler 🎉
master
(e.g., git checkout master; git merge develop
)
~1. Edit the version of the project in build.gradle
(this line)~
~1. Run a task (./gradlew uploadArchives
)~
~1. Make a commit (e.g., git add .; git commit -m "Release v2.2.0"
)~git tag v2.2.0
)git push --follow-tags
)I specified the format of a tag for deploy to ^v[0-9].*$
and added a feature removing the prefix v
in the task you suggested to follow the current naming rule of release folders.
This tag commit successfully deployed the release to /docs
and this commit properly changed the source of the library in CI (and it has errors because the v.2.2.0
changed the signature of a function).
Thanks, @myusak !! :)
Let me merge it 🎉
resolves #20.
This PR introduces a feature of auto deploy.
Procedure
master
(e.g.,git checkout master; git merge develop
)build.gradle
(this line)./gradlew uploadArchives
)git add .; git commit -m "Release v2.2.0"
)git tag v2.2.0
)git push --follow-tags
)Then,
gh-pages
branch will be updated automatically :tada:References