Compare commits
20 Commits
d0b31f0147
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
21d4c4cb71
|
|||
|
ac99f62600
|
|||
|
f2c7fd0c84
|
|||
|
8faa6dc174
|
|||
|
c5a58dc272
|
|||
|
616db3d06a
|
|||
|
bd30e2655f
|
|||
|
0c31a6b0c0
|
|||
|
2ead714719
|
|||
|
691dd0de92
|
|||
|
9e46d74a19
|
|||
|
57e5be38e6
|
|||
|
dd9235c265
|
|||
|
cccf91dfc7
|
|||
|
7ddb71d747
|
|||
|
330fd88ecc
|
|||
|
938060cd3f
|
|||
|
bdc7499fc1
|
|||
|
b606d5f463
|
|||
|
e3e5a10ec2
|
69
.github/workflows/ci.yml
vendored
Normal file
69
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-publish:
|
||||||
|
runs-on: node-latest
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: sh
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
env:
|
||||||
|
ALPINE_MIRROR: ${{ secrets.ALPINE_MIRROR }}
|
||||||
|
G_TOKEN: ${{ secrets.G_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
ALPINE_VERSION=$(cat /etc/alpine-release | cut -d'.' -f1-2) && \
|
||||||
|
echo "${ALPINE_MIRROR}v${ALPINE_VERSION}/main" > /etc/apk/repositories && \
|
||||||
|
echo "${ALPINE_MIRROR}v${ALPINE_VERSION}/community" >> /etc/apk/repositories
|
||||||
|
apk update
|
||||||
|
apk add --no-cache git
|
||||||
|
|
||||||
|
HOST="${GITHUB_SERVER_URL#https://}"
|
||||||
|
REPO="${{ github.repository }}"
|
||||||
|
AUTH_URL="https://${G_TOKEN}@${HOST}/${REPO}.git"
|
||||||
|
|
||||||
|
git clone --depth 1 --branch "$GITHUB_REF_NAME" "$AUTH_URL" .
|
||||||
|
|
||||||
|
if [ "$(git rev-parse HEAD)" != "$GITHUB_SHA" ]; then
|
||||||
|
echo "Fetching exact commit $GITHUB_SHA..."
|
||||||
|
git fetch origin "$GITHUB_SHA" --depth 1
|
||||||
|
git checkout "$GITHUB_SHA"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci --prefer-offline
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Check formatting
|
||||||
|
run: npm run format:check
|
||||||
|
|
||||||
|
# - name: Run tests
|
||||||
|
# run: npm test
|
||||||
|
|
||||||
|
- name: Build npm package
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Publish to Gitea npm registry
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
G_TOKEN: ${{ secrets.G_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
HOST="${GITHUB_SERVER_URL#https://}"
|
||||||
|
OWNER="${GITHUB_REPOSITORY_OWNER}"
|
||||||
|
|
||||||
|
npm config set "@${OWNER}:registry" "https://${HOST}/api/packages/${OWNER}/npm/"
|
||||||
|
npm config set "//${HOST}/api/packages/${OWNER}/npm/:_authToken" "${G_TOKEN}"
|
||||||
|
|
||||||
|
npm config set "//${HOST}/api/packages/npm/:_authToken" "${G_TOKEN}"
|
||||||
|
|
||||||
|
npm publish --ignore-scripts
|
||||||
47
.github/workflows/ready.yml
vendored
47
.github/workflows/ready.yml
vendored
@@ -1,47 +0,0 @@
|
|||||||
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
|
|
||||||
Reference in New Issue
Block a user