ci: made workflow github compatible
Some checks failed
Build and Deploy to CDN / build (push) Failing after 19s

This commit is contained in:
2026-05-06 15:52:20 +03:30
parent cd08e70750
commit 1649b25f05

View File

@@ -1,4 +1,5 @@
name: Build and Deploy to CDN
on:
push:
branches: [main]
@@ -8,28 +9,39 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
run: |
git clone "$GITEA_REPO_URL" repo
cd repo
git checkout $GITEA_COMMIT_SHA
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
- name: Run linter
run: npm run lint
- name: Run tests
run: npm test
- name: Build CDN assets
run: npm run build
- name: Build npm package
run: npm run build:raw
- name: Publish to Gitea npm registry
env:
GITEA_REPO_URL: ${{ gitea.repository.url }}
GITEA_COMMIT_SHA: ${{ gitea.sha }}
- name: Install Node.js
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
echo "//${{ secrets.GITEA_HOST || 'git.db123.ir' }}/api/packages/${{ github.repository_owner }}/${{ github.event.repository.name }}/npm/:_authToken=${GITEA_TOKEN}" > .npmrc
npm publish --registry https://${{ secrets.GITEA_HOST || 'git.db123.ir' }}/api/packages/${{ github.repository_owner }}/${{ github.event.repository.name }}/npm
- 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 }}/
- name: Upload CDN build as artifact
uses: actions/upload-artifact@v4
with:
name: cdn-build
path: dist/
retention-days: 7