37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '23.3.0' # Specify the Node.js version
|
|
|
|
# Step 3: Install dependencies and build
|
|
- name: Install Dependencies and Build
|
|
run: |
|
|
npm install
|
|
npm run build # Adjust to your build command
|
|
|
|
- name: Save commit id to file
|
|
run: echo "$(git rev-parse --short HEAD)" > dist/latest_commit
|
|
|
|
# Step 4: Deploy to GitHub Pages
|
|
- name: Deploy to GitHub Pages
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./dist # Replace with your build output directory
|
|
publish_branch: deployed # Deploy to the `gh-pages` branch
|