workflow fix' #5
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: Deploy Frontend to GitHub Pages | |
on: | |
push: | |
branches: ["main"] # Change to your branch name if needed | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write # Ensure this permission is granted to your token | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' # Update to your desired Node.js version | |
- name: Change directory to frontend (optional) | |
uses: actions/checkout@v4 # Checkout the specific directory (optional) | |
- working-directory: frontend # Set working directory for subsequent steps | |
run: | | |
npm install # Install dependencies within the frontend folder | |
npm run build # Build the frontend project | |
- name: Upload frontend build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: frontend-build | |
path: ./frontend/dist | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifact_name: frontend-build | |
branch: gh-pages |