From b216a3ddff3a5624bd91aed1b156946db2fadf33 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Wed, 3 Nov 2021 09:25:03 -0700 Subject: [PATCH] Build: Fix deploySite task (#3441) * Fix deploySite task. * Use set -e and update README.md. --- site/README.md | 7 ++----- site/deploy.sh | 26 ++++++++++++++++++++++++++ tasks.gradle | 16 +--------------- 3 files changed, 29 insertions(+), 20 deletions(-) create mode 100755 site/deploy.sh diff --git a/site/README.md b/site/README.md index 2df9ec207df4..a502f545652f 100644 --- a/site/README.md +++ b/site/README.md @@ -23,7 +23,7 @@ This directory contains the source for the Iceberg site. * Site structure is maintained in mkdocs.yml * Pages are maintained in markdown in the `docs/` folder -* Links use bare page names: `[link text](target-page)` +* Links use page file names: `[link text](target-page.md)` ### Installation @@ -49,12 +49,9 @@ To see changes in Javadoc, run: ### Publishing -After site changes are committed, you can publish the site with this command: +After site changes are committed, you can publish the site to the `apache` remote with this command: ``` ./gradlew deploySite ``` -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=` to the `./gradlew deploySite` command. diff --git a/site/deploy.sh b/site/deploy.sh new file mode 100755 index 000000000000..80e650d587e5 --- /dev/null +++ b/site/deploy.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +# manualy clean site, then copy .asf.yml in so that the build is clean even +# though --dirty is used so that .asf.yml is included in the deploy +rm -rf site +mkdir site +cp ../.asf.yaml site/ +mkdocs gh-deploy --dirty diff --git a/tasks.gradle b/tasks.gradle index 178b21d3a33e..ff5022e93b4a 100644 --- a/tasks.gradle +++ b/tasks.gradle @@ -52,19 +52,5 @@ task refreshJavadoc(type: Exec) { task deploySite(type: Exec) { workingDir 'site' - 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) + commandLine('./deploy.sh') }