Create build-test.yaml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Serve Docusaurus Website | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build-and-serve: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js 20.14 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20.14' | |
- name: Install dependencies | |
run: npm install | |
- name: Build website | |
run: npm run build | |
- name: Start Docusaurus server | |
run: npm run serve -- --host 0.0.0.0 | |
- name: Wait for Docusaurus to start | |
run: sleep 5 # Adjust as needed based on your server startup time | |
- name: Test Docusaurus website | |
run: | | |
curl -IsS http://localhost:3000 | head -n 1 | grep "200 OK" | |
- name: Shutdown Docusaurus server | |
run: npm run clear # Replace with your shutdown command if needed |