diff --git a/.gitea/workflows/ready.yml b/.gitea/workflows/ready.yml new file mode 100644 index 0000000..4828c5e --- /dev/null +++ b/.gitea/workflows/ready.yml @@ -0,0 +1,35 @@ +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 }}/