48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
name: Build and Deploy to CDN
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
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_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
run: |
|
|
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: Upload CDN build as artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: cdn-build
|
|
path: dist/
|
|
retention-days: 7
|