ci: made workflow github compatible
Some checks failed
Build and Deploy to CDN / build (push) Failing after 19s
Some checks failed
Build and Deploy to CDN / build (push) Failing after 19s
This commit is contained in:
56
.github/workflows/ready.yml
vendored
56
.github/workflows/ready.yml
vendored
@@ -1,4 +1,5 @@
|
|||||||
name: Build and Deploy to CDN
|
name: Build and Deploy to CDN
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
@@ -8,28 +9,39 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
run: |
|
uses: actions/checkout@v4
|
||||||
git clone "$GITEA_REPO_URL" repo
|
|
||||||
cd repo
|
- name: Setup Node.js
|
||||||
git checkout $GITEA_COMMIT_SHA
|
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:
|
env:
|
||||||
GITEA_REPO_URL: ${{ gitea.repository.url }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
GITEA_COMMIT_SHA: ${{ gitea.sha }}
|
|
||||||
|
|
||||||
- name: Install Node.js
|
|
||||||
run: |
|
run: |
|
||||||
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
|
echo "//${{ secrets.GITEA_HOST || 'git.db123.ir' }}/api/packages/${{ github.repository_owner }}/${{ github.event.repository.name }}/npm/:_authToken=${GITEA_TOKEN}" > .npmrc
|
||||||
sudo apt-get install -y nodejs
|
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
|
- name: Upload CDN build as artifact
|
||||||
run: node --version && npm --version
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
- name: Install dependencies and build
|
name: cdn-build
|
||||||
run: |
|
path: dist/
|
||||||
cd repo
|
retention-days: 7
|
||||||
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 }}/
|
|
||||||
|
|||||||
Reference in New Issue
Block a user