feat: add Woodpecker CI + Gitea deployment templates
- .woodpecker.yml: full pipeline template (install → lint-fix → lint → test → deploy) - scripts/setup-project.sh: one-command VPS setup (user, dir, deploy, sudoers, systemd, nginx) - scripts/deploy.sh: deploy script template (rsync + npm ci + systemctl + health check) - scripts/ci-lint-fix.sh: ESLint auto-fix with [CI SKIP] commit-back - docs/ci-cd.md: complete CI/CD documentation and troubleshooting - .env.example: added WOODPECKER_TOKEN - DOCS.md: added CI/CD section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
39
scripts/ci-lint-fix.sh
Executable file
39
scripts/ci-lint-fix.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# ci-lint-fix.sh — Run ESLint --fix and commit changes back to Gitea.
|
||||
#
|
||||
# Used by Woodpecker CI. If ESLint auto-fixes anything, commits with
|
||||
# [CI SKIP] to prevent an infinite pipeline loop.
|
||||
#
|
||||
# Requires GITEA_TOKEN secret in Woodpecker.
|
||||
#
|
||||
# Customize LINT_TARGETS and REPO_URL for your project.
|
||||
|
||||
LINT_TARGETS="."
|
||||
GITEA_HOST="${GITEA_HOST:-git.spektr.design}"
|
||||
GITEA_ORG="${GITEA_ORG:-gitea}"
|
||||
REPO_NAME="${CI_REPO_NAME:-$(basename "$(git rev-parse --show-toplevel)")}"
|
||||
|
||||
echo "--- Running ESLint --fix"
|
||||
# shellcheck disable=SC2086
|
||||
npx eslint --fix ${LINT_TARGETS} || true
|
||||
|
||||
if [ -z "$(git diff)" ]; then
|
||||
echo "--- No auto-fixable issues found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "--- ESLint auto-fixed issues, committing back..."
|
||||
|
||||
git config user.name "Woodpecker CI"
|
||||
git config user.email "ci@${GITEA_HOST}"
|
||||
|
||||
REPO_URL="https://gitea:${GITEA_TOKEN}@${GITEA_HOST}/${GITEA_ORG}/${REPO_NAME}.git"
|
||||
git remote set-url origin "${REPO_URL}"
|
||||
|
||||
git add -A
|
||||
git commit -m "fix: auto-fix eslint issues [CI SKIP]"
|
||||
git push origin HEAD:main
|
||||
|
||||
echo "--- Auto-fix committed and pushed"
|
||||
Reference in New Issue
Block a user