chore/svelte-kit-to-svelte-migration #6
@@ -1,59 +1,32 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
branches: [main, develop]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Project
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Install
|
||||
run: yarn install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Run SvelteKit sync
|
||||
run: yarn svelte-kit sync
|
||||
|
||||
- name: Build project
|
||||
- name: Build Svelte App
|
||||
run: yarn build
|
||||
env:
|
||||
NODE_ENV: production
|
||||
|
||||
- name: Upload build artifacts
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-artifacts
|
||||
path: |
|
||||
.svelte-kit/output
|
||||
.svelte-kit/build
|
||||
path: dist/
|
||||
retention-days: 7
|
||||
|
||||
- name: Verify build (Preview)
|
||||
run: |
|
||||
yarn preview &
|
||||
PREVIEW_PID=$!
|
||||
sleep 5
|
||||
curl -f http://localhost:4173 || exit 1
|
||||
kill $PREVIEW_PID
|
||||
|
||||
@@ -1,127 +1,42 @@
|
||||
name: Deploy
|
||||
|
||||
name: Deploy Pipeline
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
description: 'Deployment environment'
|
||||
description: 'Target'
|
||||
required: true
|
||||
default: 'production'
|
||||
type: choice
|
||||
options:
|
||||
- staging
|
||||
- production
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
options: [staging, production]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy to ${{ github.event.inputs.environment || 'production' }}
|
||||
pipeline:
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: ${{ github.event.inputs.environment || 'production' }}
|
||||
|
||||
# Only deploy after successful linting, testing, and building
|
||||
needs: [lint, test, build]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Install
|
||||
run: yarn install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Build project
|
||||
- name: Validation
|
||||
run: |
|
||||
yarn oxlint .
|
||||
yarn svelte-check
|
||||
|
||||
- name: Build for Production
|
||||
run: yarn build
|
||||
env:
|
||||
NODE_ENV: production
|
||||
|
||||
# Example deployment step - replace with your actual deployment strategy
|
||||
# Options:
|
||||
# - Docker container registry
|
||||
# - Cloud provider (AWS, GCP, Azure)
|
||||
# - Traditional hosting (Vercel, Netlify, Cloudflare Pages)
|
||||
# - SSH deployment to VPS
|
||||
|
||||
# Example: Docker image build and push
|
||||
# - name: Set up Docker Buildx
|
||||
# uses: docker/setup-buildx-action@v3
|
||||
|
||||
# - name: Log in to Container Registry
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# registry: ${{ secrets.REGISTRY_URL }}
|
||||
# username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
# password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
# - name: Build and push Docker image
|
||||
# uses: docker/build-push-action@v5
|
||||
# with:
|
||||
# context: .
|
||||
# push: true
|
||||
# tags: ${{ secrets.REGISTRY_URL }}/glyphdiff:latest
|
||||
# cache-from: type=gha
|
||||
# cache-to: type=gha,mode=max
|
||||
|
||||
# Example: SSH deployment to server
|
||||
# - name: Deploy to server via SSH
|
||||
# uses: appleboy/ssh-action@v1.0.3
|
||||
# with:
|
||||
# host: ${{ secrets.DEPLOY_HOST }}
|
||||
# username: ${{ secrets.DEPLOY_USER }}
|
||||
# key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
# script: |
|
||||
# cd /path/to/app
|
||||
# git pull origin main
|
||||
# yarn install --frozen-lockfile
|
||||
# yarn build
|
||||
# pm2 restart glyphdiff
|
||||
|
||||
# Example: Deploy to Vercel
|
||||
# - name: Deploy to Vercel
|
||||
# uses: amondnet/vercel-action@v25
|
||||
# with:
|
||||
# vercel-token: ${{ secrets.VERCEL_TOKEN }}
|
||||
# vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
|
||||
# vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
# vercel-args: '--prod'
|
||||
|
||||
- name: Deployment placeholder
|
||||
- name: Deploy Step
|
||||
run: |
|
||||
echo "Deployment step not configured yet."
|
||||
echo "Uncomment and modify one of the deployment examples above."
|
||||
echo "Configure the necessary secrets in your Gitea instance:"
|
||||
echo " - REGISTRY_URL, REGISTRY_USERNAME, REGISTRY_PASSWORD"
|
||||
echo " - DEPLOY_HOST, DEPLOY_USER, DEPLOY_SSH_KEY"
|
||||
echo " - VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID"
|
||||
|
||||
- name: Post-deployment health check
|
||||
run: |
|
||||
echo "Add health check here after deployment"
|
||||
# curl -f https://your-app.com || exit 1
|
||||
|
||||
lint:
|
||||
name: Lint Check
|
||||
uses: ./.gitea/workflows/lint.yml
|
||||
secrets: inherit
|
||||
|
||||
test:
|
||||
name: Test Suite
|
||||
uses: ./.gitea/workflows/test.yml
|
||||
secrets: inherit
|
||||
|
||||
build:
|
||||
name: Build Verification
|
||||
uses: ./.gitea/workflows/build.yml
|
||||
secrets: inherit
|
||||
echo "Deploying dist/ to ${{ github.event.inputs.environment || 'production' }}..."
|
||||
# EXAMPLE: rsync -avz dist/ user@your-vps:/var/www/html/
|
||||
|
||||
@@ -31,11 +31,18 @@ jobs:
|
||||
node-version: '20'
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Persistent Yarn Cache
|
||||
uses: actions/cache@v4
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Run oxlint
|
||||
run: yarn oxlint .
|
||||
|
||||
- name: Check code formatting
|
||||
run: yarn dprint check
|
||||
run: yarn install --frozen-lockfile --prefer-offline
|
||||
|
||||
@@ -1,45 +1,31 @@
|
||||
name: Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
- feature/*
|
||||
branches: [main, develop, "feature/*"]
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
branches: [main, develop]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
type-check:
|
||||
name: Type Check
|
||||
test:
|
||||
name: Svelte Checks
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Install
|
||||
run: yarn install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Run TypeScript type check
|
||||
run: yarn tsc --noEmit
|
||||
|
||||
- name: Run Svelte check
|
||||
- name: Type Check
|
||||
run: yarn svelte-check --threshold warning
|
||||
|
||||
- name: Lint
|
||||
run: yarn oxlint .
|
||||
|
||||
# e2e-tests:
|
||||
# name: E2E Tests (Playwright)
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user