Update data files on 2025-03-06 01:01:39 #2552
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 to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22 | |
# Step 3: Configure Git user | |
- name: Configure Git user | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
# Step 4: Check and synchronize package-lock.json if necessary | |
- name: Check and synchronize package-lock.json | |
run: | | |
if ! npm ci --dry-run > /dev/null 2>&1; then | |
echo "package-lock.json is not in sync with package.json. Synchronizing..." | |
npm install | |
git add package-lock.json | |
git commit -m "Auto-sync package-lock.json with package.json" | |
git push | |
else | |
echo "package.json and package-lock.json are in sync." | |
fi | |
# Step 5: Install dependencies and build the project | |
- name: Install dependencies and build | |
run: | | |
npm ci | |
npm run build | |
# Step 6: Deploy to GitHub Pages | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: dist |