Compare commits
11 Commits
792eea4256
...
feature/im
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2abaf6e6bf | ||
|
|
783b378673 | ||
|
|
73ccad3144 | ||
|
|
e215ba54e6 | ||
|
|
b73a52beb1 | ||
|
|
77799dded2 | ||
|
|
654f7bfec6 | ||
|
|
f35e45c38c | ||
|
|
fcfc773d87 | ||
|
|
74ff0f0673 | ||
|
|
c8cd562ca5 |
@@ -46,4 +46,4 @@ runs:
|
|||||||
- name: Set output
|
- name: Set output
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "image_url=${{ vars.INSTANCE_URL }}/${{ gitea.repository }}:${{ inputs.tag }}" >> $GITHUB_OUTPUT
|
echo "image_url=${{ vars.INSTANCE_URL }}/${{ steps.repo.outputs.name }}:${{ inputs.tag }}" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ on:
|
|||||||
branches: [main, develop]
|
branches: [main, develop]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
@@ -29,109 +29,68 @@ jobs:
|
|||||||
- name: Build app
|
- name: Build app
|
||||||
run: bun --bun run build
|
run: bun --bun run build
|
||||||
|
|
||||||
|
type-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install node
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: '22.x'
|
||||||
|
|
||||||
|
- name: Install bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: 1.3.4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun ci
|
||||||
|
|
||||||
- name: Run type checking
|
- name: Run type checking
|
||||||
run: bun --bun run check
|
run: bun --bun run check
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install node
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: '22.x'
|
||||||
|
|
||||||
|
- name: Install bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: 1.3.4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun ci
|
||||||
|
|
||||||
- name: Run linting
|
- name: Run linting
|
||||||
run: bun --bun run lint:check
|
run: bun --bun run lint:check
|
||||||
|
|
||||||
|
format-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install node
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: '22.x'
|
||||||
|
|
||||||
|
- name: Install bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: 1.3.4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bun ci
|
||||||
|
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: bun --bun run format:check
|
run: bun --bun run format:check
|
||||||
|
|
||||||
# build-docker-image:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# steps:
|
|
||||||
# - name: Set up Docker Build
|
|
||||||
# uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
# - name: Log in to registry
|
|
||||||
# uses: docker/login-action@v3
|
|
||||||
# with:
|
|
||||||
# registry: ${{ vars.INSTANCE_URL }}
|
|
||||||
# username: ${{ github.actor }}
|
|
||||||
# password: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
|
||||||
|
|
||||||
# - name: Build and push image
|
|
||||||
# uses: docker/build-push-action@v6
|
|
||||||
# with:
|
|
||||||
# push: true
|
|
||||||
# tags: ${{ vars.INSTANCE_URL }}/tech-reborn/phoenix:${{ github.sha }}
|
|
||||||
|
|
||||||
# type-check:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# container:
|
|
||||||
# image: oven/bun:alpine
|
|
||||||
# needs: install-dependencies
|
|
||||||
# steps:
|
|
||||||
# - name: Checkout code
|
|
||||||
# uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# - name: Download node_modules artifact
|
|
||||||
# uses: actions/download-artifact@v3
|
|
||||||
# with:
|
|
||||||
# name: node_modules
|
|
||||||
# path: node_modules
|
|
||||||
|
|
||||||
# - name: Run type checking
|
|
||||||
# run: bun run check
|
|
||||||
|
|
||||||
# lint:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# container:
|
|
||||||
# image: oven/bun:alpine
|
|
||||||
# needs: install-dependencies
|
|
||||||
# steps:
|
|
||||||
# - name: Checkout code
|
|
||||||
# uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# - name: Download node_modules artifact
|
|
||||||
# uses: actions/download-artifact@v3
|
|
||||||
# with:
|
|
||||||
# name: node_modules
|
|
||||||
# path: node_modules
|
|
||||||
|
|
||||||
# - name: Run linting
|
|
||||||
# run: bun run lint:check
|
|
||||||
|
|
||||||
# format-check:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# container:
|
|
||||||
# image: oven/bun:alpine
|
|
||||||
# needs: install-dependencies
|
|
||||||
# steps:
|
|
||||||
# - name: Checkout code
|
|
||||||
# uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# - name: Download node_modules artifact
|
|
||||||
# uses: actions/download-artifact@v3
|
|
||||||
# with:
|
|
||||||
# name: node_modules
|
|
||||||
# path: node_modules
|
|
||||||
|
|
||||||
# - name: Check formatting
|
|
||||||
# run: bun run format:check
|
|
||||||
|
|
||||||
# build:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# container:
|
|
||||||
# image: oven/bun:alpine
|
|
||||||
# needs: install-dependencies
|
|
||||||
# steps:
|
|
||||||
# - name: Checkout code
|
|
||||||
# uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# - name: Download node_modules artifact
|
|
||||||
# uses: actions/download-artifact@v3
|
|
||||||
# with:
|
|
||||||
# name: node_modules
|
|
||||||
# path: node_modules
|
|
||||||
|
|
||||||
# - name: Build application
|
|
||||||
# run: bun run build
|
|
||||||
|
|
||||||
# - name: Upload build artifacts
|
|
||||||
# uses: actions/upload-artifact@v4
|
|
||||||
# with:
|
|
||||||
# name: build-output
|
|
||||||
# path: build/
|
|
||||||
# retention-days: 7
|
|
||||||
|
|||||||
@@ -8,22 +8,30 @@ on:
|
|||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Get branch name
|
||||||
|
id: branch_name
|
||||||
|
uses: ./.gitea/actions/getTagSafeRef
|
||||||
|
|
||||||
- name: Determine image tag
|
- name: Determine image tag
|
||||||
id: image_tag
|
id: image_tag
|
||||||
run: |
|
run: |
|
||||||
if [[ ${{ github.ref }} == refs/tags/* ]]; then
|
if [[ ${{ github.ref }} == refs/tags/* ]]; then
|
||||||
IMAGE_TAG=${{ github.ref_name }}
|
IMAGE_TAG=${{ github.ref_name }}
|
||||||
|
ENVIRONMENT=production
|
||||||
elif [[ ${{ github.ref }} == refs/heads/develop ]]; then
|
elif [[ ${{ github.ref }} == refs/heads/develop ]]; then
|
||||||
IMAGE_TAG="develop"
|
IMAGE_TAG="develop"
|
||||||
|
ENVIRONMENT=develop
|
||||||
fi
|
fi
|
||||||
echo "tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
|
echo "tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
|
||||||
|
echo "env=$ENVIRONMENT" >> $GITHUB_OUTPUT
|
||||||
echo "Image tag will be: $IMAGE_TAG"
|
echo "Image tag will be: $IMAGE_TAG"
|
||||||
|
echo "env will be: $ENVIRONMENT"
|
||||||
|
|
||||||
- name: Build and push image
|
- name: Build and push image
|
||||||
id: docker_build
|
id: docker_build
|
||||||
@@ -33,14 +41,6 @@ jobs:
|
|||||||
REGISTRY_ACCESS_TOKEN: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
REGISTRY_ACCESS_TOKEN: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||||
REGISTRY_USER: ${{ gitea.actor }}
|
REGISTRY_USER: ${{ gitea.actor }}
|
||||||
|
|
||||||
- name: Create environment file
|
|
||||||
run: |
|
|
||||||
cat > .env << EOF
|
|
||||||
TOLGEE_API_URL=${{ vars.TOLGEE_API_URL }}
|
|
||||||
TOLGEE_API_KEY=${{ secrets.TOLGEE_API_KEY }}
|
|
||||||
TRANSLATION_CACHE_TTL=${{ vars.TRANSLATION_CACHE_TTL }}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Determine URL
|
- name: Determine URL
|
||||||
id: url
|
id: url
|
||||||
run: |
|
run: |
|
||||||
@@ -52,13 +52,61 @@ jobs:
|
|||||||
echo "url=$URL" >> $GITHUB_OUTPUT
|
echo "url=$URL" >> $GITHUB_OUTPUT
|
||||||
echo "URL will be: $URL"
|
echo "URL will be: $URL"
|
||||||
|
|
||||||
- name: Deploy application
|
- name: Setup SSH
|
||||||
uses: ./.gitea/actions/deploy
|
uses: webfactory/ssh-agent@v0.9.1
|
||||||
with:
|
with:
|
||||||
project_name: ${{ steps.branch_name.outputs.branch_name }}
|
ssh-private-key: ${{ secrets.SSH_DEPLOYMENT_KEY }}
|
||||||
url: '${{ steps.url.outputs.url }}'
|
|
||||||
image_url: ${{ steps.docker_build.outputs.image_url }}
|
- name: Add SSH host to known hosts
|
||||||
deployment_key: ${{ secrets.SSH_DEPLOYMENT_KEY }}
|
shell: bash
|
||||||
ssh_host: ${{ vars.ssh_host }}
|
run: |
|
||||||
ssh_port: ${{ vars.ssh_port }}
|
mkdir -p ~/.ssh
|
||||||
ssh_user: ${{ vars.ssh_user }}
|
ssh-keyscan -p ${{ vars.ssh_port }} ${{ vars.ssh_host }} >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- name: Create environment file
|
||||||
|
run: |
|
||||||
|
cat > .env << EOF
|
||||||
|
IMAGE_URL='${{ steps.docker_build.outputs.image_url }}'
|
||||||
|
URL='${{ steps.url.outputs.url }}'
|
||||||
|
REGISTRY=git.klemp.dev
|
||||||
|
PROJECT_NAME=${{ steps.branch_name.outputs.branch_name }}
|
||||||
|
COMPOSE_PROJECT_NAME=${{ steps.branch_name.outputs.branch_name }}
|
||||||
|
TOLGEE_API_URL=${{ vars.TOLGEE_API_URL }}
|
||||||
|
TOLGEE_API_KEY=${{ secrets.TOLGEE_API_KEY }}
|
||||||
|
TRANSLATION_CACHE_TTL=${{ vars.TRANSLATION_CACHE_TTL }}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Remove old Docker context
|
||||||
|
run: 'docker context rm deploy_target 2>/dev/null || true'
|
||||||
|
|
||||||
|
- name: Create Docker context
|
||||||
|
run: 'docker context create deploy_target --docker "host=ssh://${{ vars.ssh_user }}@${{ vars.ssh_host }}:${{ vars.ssh_port }}"'
|
||||||
|
|
||||||
|
- name: Stop existing deployment
|
||||||
|
run: |
|
||||||
|
DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.image_tag.outputs.env }} down --remove-orphans || true
|
||||||
|
|
||||||
|
- name: Pull latest images
|
||||||
|
run: |
|
||||||
|
DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.image_tag.outputs.env }} pull
|
||||||
|
|
||||||
|
- name: Deploy with Docker Compose
|
||||||
|
id: deploy
|
||||||
|
run: |
|
||||||
|
DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.image_tag.outputs.env }} up -d
|
||||||
|
|
||||||
|
echo "Waiting for services to start..."
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
CONTAINERS=$(DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.image_tag.outputs.env }} ps --services | tr '\n' ',' | sed 's/,$//')
|
||||||
|
echo "containers=$CONTAINERS" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
echo "✅ Deployment completed successfully!"
|
||||||
|
echo "🌐 URL: ${{ steps.url.outputs.url }}"
|
||||||
|
echo "📦 Containers: $CONTAINERS"
|
||||||
|
|
||||||
|
- name: Show deployment status
|
||||||
|
run: |
|
||||||
|
echo "=== Deployment Status ==="
|
||||||
|
DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.image_tag.outputs.env }} ps
|
||||||
|
echo "========================="
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler"
|
||||||
},
|
}
|
||||||
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
||||||
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user