Skip to content

[NO-JIRA][Website] Wipe out the old contents of asf-site branch (#3110) #8

[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 (#3110) #8

Workflow file for this run

# 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
#
# https://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.
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
# 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
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.132.1
steps:
- name: Install Hugo CLI
run: |
wget -q -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Node.js dependencies
working-directory: doc/
run: ls -lah && npm ci
- name: Build with Hugo
working-directory: doc/
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
TZ: America/Los_Angeles
run: |
hugo \
--gc \
--minify \
--destination ${{ runner.temp }}/website \
--baseURL "/"
- name: Commit new site
run: |
set -ex
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 --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