62 lines
1.9 KiB
YAML
62 lines
1.9 KiB
YAML
name: Next.js App CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Login to Gitea Package Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{vars.LOCAL_REGISTRY}}
|
|
username: ${{ VARS.USER }}
|
|
password: ${{ secrets.TOKEN }}
|
|
|
|
# --- ADDED: Step to generate image assets before the build ---
|
|
- name: Generate Static Image Assets
|
|
run: |
|
|
# Install dependencies required by the scripts
|
|
sudo apt-get update && sudo apt-get install -y imagemagick webp
|
|
|
|
# Make scripts executable
|
|
chmod +x ./scripts/*.sh
|
|
|
|
# Run the scripts to generate PNGs from PDFs and create WebP images
|
|
echo "Generating PNGs from PDFs..."
|
|
bash ./scripts/first_page_image.sh
|
|
echo "Generating WebP images..."
|
|
bash ./scripts/generate_webp.sh
|
|
|
|
# --- REPLACED: The following steps are changed from Ruby/Jekyll to Node.js/Next.js ---
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20.x' # Use a current LTS version of Node.js
|
|
cache: 'npm'
|
|
|
|
- name: Install Node.js Dependencies
|
|
run: npm ci # 'npm ci' is recommended for CI for faster, reliable installs
|
|
|
|
- name: Build Next.js App
|
|
run: npm run build
|
|
# --- END OF REPLACED STEPS ---
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
# --- UNCHANGED: This step remains the same as requested ---
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
push: true
|
|
tags: |
|
|
${{ vars.LOCAL_REGISTRY }}/${{ gitea.repository_owner }}/website:latest
|
|
${{ vars.LOCAL_REGISTRY }}/${{ gitea.repository_owner }}/website:${{ gitea.sha }} |