From 3af48b8ee2a81c8045b86b9221197089f9383443 Mon Sep 17 00:00:00 2001 From: gongzhongqiang <764629910@qq.com> Date: Tue, 9 Apr 2024 22:07:10 +0800 Subject: [PATCH] [FLINK-34953][ci]Add GitHub ci for flink-web to auto commit build files --- .github/workflows/docs.yml | 66 +++++++++++++++++++ .../how-to-contribute/improve-website.md | 9 +-- .../how-to-contribute/improve-website.md | 8 +-- 3 files changed, 68 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000000..15b8e1a011 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,66 @@ +# 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. + +name: "Flink Web CI" +on: + pull_request: + push: + branches: + - asf-site + workflow_dispatch: + +jobs: + build-documentation: + if: github.repository == 'apache/flink-web' + runs-on: ubuntu-latest + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository. + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: '0.119.0' + extended: true + + - name: Build website + run: | + # Remove old content folder and create new one + rm -r -f content && mkdir content + + # Build the website + hugo --source docs --destination target + + # Move newly generated static HTML to the content serving folder + mv docs/target/* content + + # Copy quickstarts, rewrite rules and Google Search Console identifier + cp -r _include/. content + + # Get the current commit author + echo "author=$(git log -1 --pretty=\"%an <%ae>\")" >> $GITHUB_OUTPUT + + - name: Commit and push website build + if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} + uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 + with: + commit_author: ${{ steps.last-commit.outputs.author }} + commit_message: Rebuild website diff --git a/docs/content.zh/how-to-contribute/improve-website.md b/docs/content.zh/how-to-contribute/improve-website.md index 1e90ab6f07..454e070f51 100644 --- a/docs/content.zh/how-to-contribute/improve-website.md +++ b/docs/content.zh/how-to-contribute/improve-website.md @@ -97,11 +97,4 @@ Flink 项目通过 [GitHub Mirror](https://github.com/apache/flink-web) 以提 ### 合并 pull request -默认所有的修改仅在源文件上完成(对 `content/` 目录中自动生成的文件没有修改)。 在推送网站更改之前,请运行构建脚本。 - -``` -./build.sh -``` - -将更改添加到 `content/` 目录作为附加提交,并将更改推送到 ASF 基本仓库。 - +默认所有的修改仅在源文件上完成(对 `content/` 目录中自动生成的文件没有修改)。 diff --git a/docs/content/how-to-contribute/improve-website.md b/docs/content/how-to-contribute/improve-website.md index 959cb7f364..1171bc81e4 100644 --- a/docs/content/how-to-contribute/improve-website.md +++ b/docs/content/how-to-contribute/improve-website.md @@ -97,10 +97,4 @@ Details on how to set the credentials for the ASF git repository are [linked her ### Merging a pull request -Contributions are expected to be done on the source files only (no modifications on the compiled files in the `content/` directory.). Before pushing a website change, please run the build script - -``` -./build.sh -``` - -add the changes to the `content/` directory as an additional commit and push the changes to the ASF base repository. +Contributions are expected to be done on the source files only (no modifications on the compiled files in the `content/` directory.).