Skip to content

Test docusaurus workflow #5

Test docusaurus workflow

Test docusaurus workflow #5

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
#
# 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: docusaurus
on:
pull_request:
types:
- opened
- synchronize
push:
concurrency:
group: docusaurus-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
script_dir: .github/scripts
# TODO add docker image caching
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Build Docker image
run: |
docker compose build
build-website:
needs:
- build-image
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Build website
run: |
docker compose run site pnpm build
- name: Save website build artifact
uses: actions/upload-artifact@v4
with:
name: build
path: build
if-no-files-found: error
check-sitemap:
needs:
- build-website
runs-on: ubuntu-latest
steps:
- name: Get URL check script
uses: actions/checkout@v4
- name: Download website build artifact
uses: actions/download-artifact@v4
with:
name: build
path: build
- name: Check sitemap.xml
working-directory: ${{ env.script_dir }}
run: |
./url.sh "$GITHUB_WORKSPACE"/build/sitemap.xml
run-website:
needs:
- build-website
runs-on: ubuntu-latest
steps:
- name: Get Docker files
uses: actions/checkout@v4
- name: Download website build artifact
uses: actions/download-artifact@v4
with:
name: build
path: build
- name: Curl website homepage
run: |
docker compose run --detach --service-ports site pnpm serve
while true; do
curl --head --silent http://localhost:3000 | head -n1 | grep "OK";
[ $? -eq 0 ] && break;
sleep 1;
done
publish-website:
if: ${{ github.event == push && github.ref_name == HDDS-9225-website-v2 }}

Check failure on line 96 in .github/workflows/docusaurus.yml

View workflow run for this annotation

GitHub Actions / docusaurus

Invalid workflow file

The workflow is not valid. .github/workflows/docusaurus.yml (Line: 96, Col: 9): Unrecognized named-value: 'push'. Located at position 17 within expression: github.event == push && github.ref_name == HDDS-9225-website-v2
needs:
- run-website
- check-sitemap
runs-on: ubuntu-latest
steps:
- name: Download website build artifact
uses: actions/download-artifact@v4
with:
name: build
path: build
- name: "Checkout publish branch"
uses: actions/checkout@v4
with:
path: 'publish'
# Update this to asf-site when the website is ready to be published.
ref: 'asf-site-v2'
- name: "Commit changes"
working-directory: 'publish'
run: |
# Delete previous build from the branch, but preserve files with necessary metadata.
mv README.md .asf.yaml .git /tmp
rm -rf $(ls -A)
mv /tmp/README.md /tmp/.asf.yaml /tmp/.git .
# Commit new build to the branch.
cp -R ../build/. .
git config --global user.name 'Github Actions'
git config --global user.email 'noreply@github.com'
git add .
git commit -a -m "[auto] Apply changes from $GITHUB_REF_NAME $GITHUB_SHA" || true
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}