Skip to content

Commit

Permalink
Build: Fix deploySite Gradle task (apache#3008)
Browse files Browse the repository at this point in the history
Fixes the deploySite Gradle task by ensuring that the `.asf.yaml` file located in the project root is included in the `site` directory before it is pushed to the `asf-site` branch. If the `.asf.yaml` file is not included, ASF INFRA's site publishing mechanism will ignore the update.

More info is available here:
* https://infra.apache.org/project-site.html
* https://infra.apache.org/asfyaml-mkdocs.html
  • Loading branch information
cwsteinbach authored Aug 27, 2021
1 parent 7d6f692 commit 237b72d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 4 additions & 2 deletions site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ To see changes in Javadoc, run:
After site changes are committed, you can publish the site with this command:

```
mkdocs gh-deploy
./gradlew deploySite
```

This assumes that the Apache remote is named `apache` and will push to the `asf-site` branch. To use a different remote add `-r <remote-name>`.
This assumes that the Apache remote is named `apache` and will push to the
`asf-site` branch. You can specify the name of a different remote by appending
`-Premote.name=<remote-name>` to the `./gradlew deploySite` command.
17 changes: 15 additions & 2 deletions tasks.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ task refreshJavadoc(type: Exec) {

task deploySite(type: Exec) {
workingDir 'site'
commandLine 'mkdocs', 'gh-deploy'
}
def remoteName = 'apache'
if (project.hasProperty('remote.name')) {
remoteName = project.getProperty('remote.name')
}

// Normally the site directory is removed and built entirely from the docs
// directory when `mkdocs gh-deploy` runs. Removing the site directory,
// copying the file by hand, and using --dirty does basically the same thing,
// but allows us to end up with .asf.yaml in the output that gets copied to
// the asf-site branch. That's required for publishing now, which is why this
// workaround is necessary. For further clarification please see
// https://github.com/apache/iceberg/pull/2998#discussion_r693517612
commandLine('rm', '-rf', 'site')
commandLine('cp', '../.asf.yaml', 'site/')
commandLine('mkdocs', 'gh-deploy', '--dirty', '-r', remoteName)
}

0 comments on commit 237b72d

Please sign in to comment.