| # |
| # 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: Build and Deploy Jekyll Site |
| |
| on: |
| push: |
| branches: |
| - master |
| paths: |
| - site/** |
| |
| permissions: |
| contents: write |
| |
| jobs: |
| build-site: |
| runs-on: ubuntu-latest |
| |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@v2 |
| with: |
| fetch-depth: 0 |
| |
| - name: Set up Ruby |
| uses: ruby/setup-ruby@v1 |
| with: |
| ruby-version: '3.2.5' |
| |
| - name: Set up Node.js |
| uses: actions/setup-node@v2 |
| with: |
| # TODO: Lock done a specifc version for node and ruby and define |
| # it in single place to be shared by this action and /site/Dockerfile |
| node-version: '20' |
| |
| - name: Run build script |
| run: | |
| chmod +x ./build.sh |
| ./build.sh |
| working-directory: site |
| |
| - name: Commit and push to asf-site branch |
| run: | |
| git config user.name "GitHub Actions Bot" |
| git config user.email "action@github.com" |
| cp -r site/_site /tmp/ |
| git reset --hard |
| git clean -fdx |
| git checkout asf-site |
| rm -rf * |
| mv /tmp/_site ./content |
| git add . |
| git commit -m "Automatic Site Publish by Buildbot" || echo "No changes to commit" |
| git push origin asf-site |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |