ci: add Gitea Actions workflows for build + EasyPanel deploy
Two workflows under .gitea/workflows/:
- build-and-deploy.yml: on push to source-code, install deps, run
astro build, then POST the dist/ SHA + ref to EASYPANEL_WEBHOOK_URL
(read from repo secret) so EasyPanel redeploys. Uploads dist/ as a
7-day artifact as a fallback. Gracefully warns if the secret is empty
so contributors can run the build job without breaking.
- lint.yml: lightweight build check on every push + PR so syntax /
missing-image errors surface before the deploy workflow runs.
To enable auto-deploy:
1. Set EASYPANEL_WEBHOOK_URL secret in Gitea repo settings
2. Configure EasyPanel service to source from this repo + branch
source-code, build command 'npm run build', output 'dist'
This commit is contained in:
48
.gitea/workflows/build-and-deploy.yml
Normal file
48
.gitea/workflows/build-and-deploy.yml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: Build & Deploy to EasyPanel
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- source-code
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-notify:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci --no-audit --no-fund
|
||||||
|
|
||||||
|
- name: Build Astro site
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Trigger EasyPanel deploy
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
EASYPANEL_WEBHOOK_URL: ${{ secrets.EASYPANEL_WEBHOOK_URL }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$EASYPANEL_WEBHOOK_URL" ]; then
|
||||||
|
echo "::warning::EASYPANEL_WEBHOOK_URL secret is empty — skipping deploy trigger. Set it in repo settings to enable auto-deploy."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "Triggering EasyPanel deploy at $EASYPANEL_WEBHOOK_URL"
|
||||||
|
curl -fsS -X POST "$EASYPANEL_WEBHOOK_URL" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"ref\":\"${{ github.ref }}\",\"sha\":\"${{ github.sha }}\",\"event\":\"push\"}" \
|
||||||
|
|| echo "::error::EasyPanel webhook returned non-2xx (continuing — site already built in artifact if you want to download)"
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist/
|
||||||
|
retention-days: 7
|
||||||
22
.gitea/workflows/lint.yml
Normal file
22
.gitea/workflows/lint.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
name: Lint & Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- source-code
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- source-code
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'npm'
|
||||||
|
- run: npm ci --no-audit --no-fund
|
||||||
|
- name: Build (catches syntax + missing-image errors before deploy)
|
||||||
|
run: npm run build
|
||||||
Reference in New Issue
Block a user