From b3743f73289bb935b277e80e4cb9f508900598f4 Mon Sep 17 00:00:00 2001 From: Martin Grigorov Date: Thu, 22 Aug 2024 14:44:50 +0300 Subject: [PATCH] [NO-JIRA][Website] Wipe out the old contents of asf-site branch (#3110) * [NO-JIRA][Website] Wipe out the old contents of asf-site branch and copy over only the newly generated .html files Also create a simple .asf.yaml file with `publish` Signed-off-by: Martin Tzvetanov Grigorov Signed-off-by: Martin Tzvetanov Grigorov * Update the commit message to link to its trigger Signed-off-by: Martin Tzvetanov Grigorov * Improve the workflow description comment Signed-off-by: Martin Tzvetanov Grigorov * Use `hugo --destination ...` instead of moving folders later Signed-off-by: Martin Tzvetanov Grigorov --------- Signed-off-by: Martin Tzvetanov Grigorov --- .github/workflows/deploy-docs.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 925244b409b..0ef81b3f162 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -16,8 +16,8 @@ # to commit it to your repository. -# Sample workflow for building and deploying a Hugo site to GitHub Pages -name: Deploy Hugo site to Pages +# A Github Actions workflow that builds and copies the website to asf-site branch +name: Deploy website on: # Runs on pushes targeting the default branch @@ -64,16 +64,26 @@ jobs: hugo \ --gc \ --minify \ - --baseURL "https://avro.apache.org/" + --destination ${{ runner.temp }}/website \ + --baseURL "/" - name: Commit new site run: | set -ex - mv doc/public docs/ + rsync \ + -a \ + --delete \ + --exclude '/.git/' \ + ${{ runner.temp }}/website/ \ + ./ + echo "publish: + whoami: asf-site + " > .asf.yaml + touch .nojekyll git config --global user.email "dev@avro.apache.org" git config --global user.name "Github Actions" git checkout --orphan asf-site-staging - git add . - git commit -m "Update docs" + git add --all + git commit -m "Publish built website triggered by ${{ github.sha }}" git checkout asf-site git reset --hard asf-site-staging git push origin asf-site --force