Merge pull request #27 from vara-bonthu/readme #19
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
# Workflow to deploy a Docusaurus website to GitHub Pages upon push to the `main` branch | |
name: website-deploy-to-github-pages | |
# This workflow runs whenever there is a push to the `main` branch | |
on: | |
push: | |
branches: | |
- main # Deploy only when changes are pushed to the `main` branch | |
jobs: | |
deploy: | |
name: Deploy to GitHub Pages # Job name for clarity in logs | |
runs-on: ubuntu-latest # Use the latest stable Ubuntu runner | |
# Set default behavior for all steps within the job | |
defaults: | |
run: | |
shell: bash # Use Bash shell for commands | |
working-directory: website # Specify the working directory for the steps | |
steps: | |
# Step 1: Check out the repository code | |
- uses: actions/checkout@v3 # Checkout action to pull the code from the repo to the runner | |
# Step 2: Set up Node.js environment | |
- uses: actions/setup-node@v3 # Setup Node.js with the desired version | |
with: | |
node-version: 18 # Specify Node.js version to use (LTS) | |
cache: npm # Enable caching of npm modules to improve speed on subsequent runs | |
cache-dependency-path: website/package-lock.json # Define path for npm dependency caching | |
# Step 3: Install dependencies | |
- name: Install dependencies | |
run: npm install # Use `npm install` instead of `npm ci` to sync package.json and package-lock.json if needed | |
# Step 4: Build the website | |
- name: Build website | |
run: npm run build # Run the build command to generate static files in the `website/build` directory | |
# Step 5: Deploy built files to GitHub Pages | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 # Action to deploy static content to the `gh-pages` branch | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} # Use GitHub token for authentication | |
publish_dir: ./website/build # Specify the directory where the built static files are located | |
user_name: github-actions[bot] # Commit the changes as the GitHub Actions bot | |
user_email: github-actions[bot]@users.noreply.github.com # Set email for the commit |