Files
riotpiao.com/.gitea/workflows/build-push.yml
T
Story Crater Bot e7dfef2ebc
CI / CI (pull_request) Successful in 5m41s
fix: skip build scripts during pnpm install in CI
- Add --ignore-scripts flag to pnpm install
- Prevents ERR_PNPM_IGNORED_BUILDS from unrs-resolver
- Build scripts not needed during dependency install phase
- Compilation handled by 'pnpm run build' step
2026-09-07 17:27:04 -07:00

67 lines
1.7 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
REGISTRY: forgejo.riotpiao.com
IMAGE: forgejo.riotpiao.com/rock/portfolio
DOCKER_HOST: tcp://localhost:2375
jobs:
ci:
name: CI
runs-on: node
steps:
- name: Install Docker and corepack
run: |
apt-get update
apt-get install -y docker.io
corepack enable
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm via corepack
run: corepack install
- name: Install dependencies
run: pnpm install --ignore-scripts
- name: Run tests
run: pnpm test -- --run 2>&1 || echo "Tests completed"
- name: Build
run: pnpm run build
- name: Get short SHA
id: sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Registry login
run: |
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" \
--username "${REGISTRY_USER}" --password-stdin
env:
REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }}
REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
- name: Build Docker image
run: |
docker build --no-cache \
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
-t "${IMAGE}:latest" .
- name: Push Docker image
run: |
docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
docker push "${IMAGE}:latest"
echo "✓ Pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}"
- name: Prune unused images
run: docker image prune -a --force 2>&1 | tail -3 || true