| # |
| # 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: Apache Wayang Ruby deploy |
| run-name: Deploying latest updates on Apache Wayang Website |
| env: |
| BRANCH_PAGE: asf-site |
| URL: "https://wayang.apache.org" |
| BASE_URL: "/" |
| REPO_URL: $(git remote get-url origin) |
| VALIDATE: "" |
| # USER: |
| # TOKEN: |
| # TRAVIS_REPO_SLUG: |
| on: |
| push: |
| branches: [ main ] |
| # pull_request: |
| # branches: [ main ] |
| jobs: |
| test: |
| runs-on: ubuntu-latest |
| strategy: |
| matrix: |
| ruby-version: [2.6.3] |
| continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} |
| steps: |
| - uses: actions/checkout@v3 |
| - name: Set up Ruby |
| uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 |
| with: |
| ruby-version: ${{ matrix.ruby-version }} |
| bundler-cache: true |
| |
| - name: Install dependencies (Ruby) |
| run: bundle install |
| |
| - name: Install dependencies (Ubuntu) |
| run: | |
| sudo apt-get update |
| sudo apt-get install -y libcurl4-openssl-dev |
| |
| build: |
| runs-on: ubuntu-latest |
| strategy: |
| matrix: |
| ruby-version: [2.6.3] |
| continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} |
| steps: |
| - uses: actions/checkout@v3 |
| - name: Set up Ruby |
| uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 |
| with: |
| ruby-version: ${{ matrix.ruby-version }} |
| bundler-cache: true |
| |
| - name: Install dependencies (Ruby) |
| run: | |
| bundle install |
| |
| - name: Install dependencies (Ubuntu) |
| run: | |
| sudo apt-get update |
| sudo apt-get install -y libcurl4-openssl-dev |
| |
| - name: Setting _config.yaml |
| run: | |
| export JEKYLL_ENV="production" |
| |
| echo "url: \"$URL\"" > _config.yml.tmp |
| echo "baseurl: \"$BASE_URL\"" >> _config.yml.tmp |
| cat _config.yml | grep -v "url:" >> _config.yml.tmp |
| mv _config.yml.tmp _config.yml |
| |
| - name: Validating ./_site |
| run: | |
| bundle exec jekyll build |
| if [ "$VALIDATE" != "" ]; then |
| bundle exec htmlproofer ./_site |
| else |
| echo "it will not validate the site" |
| fi |
| |
| - name: Moving and copying files |
| run: | |
| mkdir -p ../tmp |
| mv ./_site/* ../tmp |
| rm -rf ../tmp/script |
| cp DISCLAIMER ../tmp |
| cp LICENSE.TXT ../tmp |
| cp NOTICE.TXT ../tmp |
| cp .gitignore ../tmp |
| cp .asf.yaml ../tmp |
| |
| # - name: Cloning repository |
| # run: | |
| # #git pull origin $BRANCH_PAGE --allow-unrelated-histories |
| # #git checkout $BRANCH_PAGE |
| |
| - name: Cloning repository |
| run: | |
| mkdir ../$BRANCH_PAGE |
| cd ../$BRANCH_PAGE |
| git clone --depth 50 --branch $BRANCH_PAGE $(git remote get-url origin) |
| |
| - name: Delete the old file that it was not gerenated |
| run: | |
| rm -rf $(diff --exclude=".git" --exclude="./docs" -q ../tmp/ ./ | awk '/Only in \.\//{print substr($3, 1, length($3)-1) "" $4}') |
| |
| - name: Syncing files |
| run: | |
| rsync -av ../tmp/* ./ |
| cp ../tmp/.gitignore ./ |
| cp ../tmp/.asf.yaml ./ |
| |
| # Commenting this step while we understand if still necessary |
| # - name: Commiting changes on Travis branch |
| # run: | |
| # git add -A |
| # git status |
| # git commit -m "Lastest site built on successful travis build ${{github.run_number}} auto-pushed to github" |
| # git remote set-url origin https://${{secrets.USER}}:${{secrets.TOKEN}}@github.com/$TRAVIS_REPO_SLUG}} |
| # git push origin $BRANCH_PAGE:$BRANCH_PAGE |