36 lines
919 B
YAML
36 lines
919 B
YAML
name: Build and Deploy to CDN
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
run: |
|
|
git clone "$GITEA_REPO_URL" repo
|
|
cd repo
|
|
git checkout $GITEA_COMMIT_SHA
|
|
env:
|
|
GITEA_REPO_URL: ${{ gitea.repository.url }}
|
|
GITEA_COMMIT_SHA: ${{ gitea.sha }}
|
|
|
|
- name: Install Node.js
|
|
run: |
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
|
|
sudo apt-get install -y nodejs
|
|
|
|
- name: Verify Node and npm
|
|
run: node --version && npm --version
|
|
|
|
- name: Install dependencies and build
|
|
run: |
|
|
cd repo
|
|
npm ci
|
|
npm run build
|
|
npm test
|
|
|
|
- name: Deploy via rsync
|
|
run: rsync -avz --delete repo/dist ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.DEPLOY_PATH }}/
|