Merge pull request #7 from penwern/dev-pull #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: Webpack Build and Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- main # This triggers the workflow when changes are pushed to main | |
jobs: | |
build: | |
runs-on: ubuntu-latest # Using the latest Ubuntu runner | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 # Check out the repository to work with it | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" # Adjust Node.js version if needed | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm # Caching npm modules to speed up installs | |
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-modules- | |
- name: Install dependencies | |
run: | | |
npm install # Install dependencies | |
- name: Build with Webpack | |
run: | | |
npm run build # Run Webpack to create the build | |
- name: Deploy to GitHub Pages (gh-pages) | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} # Authentication using the GitHub token | |
publish_dir: ./dist # Path to the build directory (dist) | |
publish_branch: gh-pages # Deploy to the gh-pages branch | |
user_name: "github-actions" # Default username for GitHub Actions | |
user_email: "[email protected]" # Default email for GitHub Actions |