Skip to content

Commit

Permalink
Test docusaurus workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
errose28 committed Feb 7, 2024
1 parent d20d2e1 commit f1c0f73
Showing 1 changed file with 91 additions and 2 deletions.
93 changes: 91 additions & 2 deletions .github/workflows/docusaurus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,104 @@ 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:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Build Docker image
run: |
docker compose build
- name: Run test
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 }}
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 }}

0 comments on commit f1c0f73

Please sign in to comment.