57 Commits

Author SHA1 Message Date
Tobias Klemp
f35e45c38c fix format
All checks were successful
CI / build-and-test (push) Successful in 3m41s
Deploy / build-and-deploy (push) Successful in 18m46s
2026-01-03 18:38:47 +01:00
Tobias Klemp
fcfc773d87 fix build image url output casing
Some checks failed
Deploy / build-and-deploy (push) Successful in 16m0s
CI / build-and-test (push) Failing after 2m24s
2026-01-03 18:00:39 +01:00
Tobias Klemp
74ff0f0673 next try
Some checks failed
CI / build-and-test (push) Failing after 3m24s
Deploy / build-and-deploy (push) Failing after 16m47s
2026-01-03 17:35:30 +01:00
Tobias Klemp
c8cd562ca5 fixes
Some checks failed
CI / build-and-test (push) Failing after 4m31s
Deploy / build-and-deploy (push) Failing after 17m50s
2026-01-03 17:15:57 +01:00
Tobias Klemp
792eea4256 normal deployment
Some checks failed
CI / build-and-test (push) Failing after 11m50s
Deploy / build (push) Failing after 23m58s
2026-01-03 16:33:04 +01:00
Tobias Klemp
d5bf76a5af typos
Some checks failed
CI / build-and-test (push) Failing after 2m59s
2026-01-02 20:12:52 +01:00
Tobias Klemp
0a7f510648 remove old workflow
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 20:12:19 +01:00
Tobias Klemp
7a658fc51e change order
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 20:09:57 +01:00
Tobias Klemp
b3ffeec337 try using action
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 20:07:20 +01:00
Tobias Klemp
87753edb9a define external tolgee network
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 19:22:53 +01:00
Tobias Klemp
70a160e9f5 join tolgee network
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 19:19:40 +01:00
Tobias Klemp
aab8c84f5c more logs
Some checks failed
CI / build-and-test (push) Failing after 3m13s
2026-01-02 17:22:40 +01:00
Tobias Klemp
a89da7771a do build
Some checks failed
CI / build-and-test (push) Failing after 4m16s
2026-01-02 17:03:02 +01:00
Tobias Klemp
9cf825664a add debug
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 17:02:44 +01:00
Tobias Klemp
2823c55647 fix typo #2
Some checks failed
CI / build-and-test (push) Failing after 3m22s
2026-01-02 16:54:42 +01:00
Tobias Klemp
9636b9bcc9 fix typo
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 16:52:14 +01:00
Tobias Klemp
c3b67fa626 remove .env file, setting it in compose file
Some checks failed
CI / build-and-test (push) Failing after 4m11s
2026-01-02 16:34:26 +01:00
Tobias Klemp
ee6f30f283 set env variables
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 16:30:56 +01:00
Tobias Klemp
2b54ec69ae fix: load copy env file in build
Some checks failed
CI / build-and-test (push) Failing after 2m42s
2026-01-02 16:21:08 +01:00
Tobias Klemp
9166be8ab0 fix compose file
Some checks failed
CI / build-and-test (push) Failing after 3m15s
2026-01-02 16:16:09 +01:00
Tobias Klemp
c95fb00548 typo
Some checks failed
CI / build-and-test (push) Failing after 3m38s
2026-01-02 16:05:37 +01:00
Tobias Klemp
906028f3c8 fix compose file
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 16:02:49 +01:00
Tobias Klemp
8efa1c64d4 try variable
Some checks failed
CI / build-and-test (push) Failing after 3m0s
2026-01-02 15:57:05 +01:00
Tobias Klemp
a20a7b31e9 use modern docker compose syntax
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 15:55:03 +01:00
Tobias Klemp
ddddaf327d use variable for context
Some checks failed
CI / build-and-test (push) Failing after 2m52s
2026-01-02 15:52:06 +01:00
Tobias Klemp
0ab4d13091 basic ssh test
Some checks failed
CI / build-and-test (push) Failing after 2m51s
2026-01-02 12:10:08 +01:00
Tobias Klemp
11bfa81c78 test ssh setup
Some checks failed
CI / build-and-test (push) Failing after 2m55s
2026-01-02 12:06:32 +01:00
Tobias Klemp
8d45979b18 add to known hosts
Some checks failed
CI / build-and-test (push) Failing after 3m4s
2026-01-02 11:57:45 +01:00
Tobias Klemp
5b3ccf5d1f remove other inputs
Some checks failed
CI / build-and-test (push) Failing after 3m11s
2026-01-02 11:49:31 +01:00
Tobias Klemp
ee1148ca9f debug
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 11:46:58 +01:00
Tobias Klemp
9582106dc6 try
Some checks failed
CI / build-and-test (push) Failing after 2m15s
2026-01-02 01:56:56 +01:00
Tobias Klemp
960770d73b add debug
Some checks failed
CI / build-and-test (push) Failing after 2m23s
2026-01-02 01:49:44 +01:00
Tobias Klemp
8d36f66ea7 debug
Some checks failed
CI / build-and-test (push) Failing after 2m27s
2026-01-02 01:46:35 +01:00
Tobias Klemp
6707f4d93a meh, skip buildl
Some checks failed
CI / build-and-test (push) Failing after 2m27s
2026-01-02 01:42:59 +01:00
Tobias Klemp
0085aa690f remove unecessary build steps
Some checks failed
CI / build-and-test (push) Failing after 3m15s
2026-01-02 01:32:49 +01:00
Tobias Klemp
b048a9d4a6 key in inputs
Some checks failed
CI / build-and-test (push) Failing after 3m8s
2026-01-02 01:09:03 +01:00
Tobias Klemp
4c8e159236 maybe
Some checks failed
CI / build-and-test (push) Failing after 2m54s
2026-01-02 00:52:53 +01:00
Tobias Klemp
0db1f6432c i dont know
Some checks failed
CI / build-and-test (push) Failing after 3m14s
2026-01-02 00:40:26 +01:00
Tobias Klemp
fb893cf056 huh
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 00:38:14 +01:00
Tobias Klemp
27c46570df ahhh
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 00:35:52 +01:00
Tobias Klemp
00aeee85a6 different syntax
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-02 00:33:41 +01:00
Tobias Klemp
f7e5ddb0da fix repositry casing
Some checks failed
CI / build-and-test (push) Failing after 2m45s
2026-01-02 00:30:33 +01:00
Tobias Klemp
96cdd6d0a4 use inputs
Some checks failed
CI / build-and-test (push) Failing after 2m50s
2026-01-02 00:25:24 +01:00
Tobias Klemp
1a30ce6b75 different syntax
Some checks failed
CI / build-and-test (push) Failing after 2m49s
2026-01-02 00:20:34 +01:00
Tobias Klemp
276d035df7 use env
Some checks failed
CI / build-and-test (push) Failing after 2m58s
2026-01-02 00:17:14 +01:00
Tobias Klemp
cb45cd0c5c use default token
Some checks failed
CI / build-and-test (push) Failing after 2m44s
2026-01-02 00:11:21 +01:00
Tobias Klemp
2f97f60196 build noo
Some checks failed
CI / build-and-test (push) Failing after 3m1s
2026-01-02 00:05:37 +01:00
Tobias Klemp
c27bb14060 actually build smth
Some checks failed
CI / build-and-test (push) Failing after 3m9s
2026-01-02 00:00:39 +01:00
Tobias Klemp
fd88dadf21 tidy up
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-01 23:58:01 +01:00
Tobias Klemp
2f79f0c4fe use gitea api with curl
Some checks failed
CI / build-and-test (push) Failing after 2m37s
2026-01-01 23:53:25 +01:00
Tobias Klemp
da4952aaa6 try using gitea api
Some checks failed
CI / build-and-test (push) Failing after 3m40s
2026-01-01 23:34:33 +01:00
Tobias Klemp
e4953aa769 test debug
Some checks failed
CI / build-and-test (push) Failing after 4m17s
2026-01-01 23:26:13 +01:00
Tobias Klemp
0bf4036603 fix actions
Some checks failed
CI / build-and-test (pull_request) Failing after 7m3s
CI / build-and-test (push) Failing after 6m21s
2026-01-01 19:42:22 +01:00
Tobias Klemp
a0b9e5b692 fix path
Some checks failed
CI / build-and-test (push) Failing after 2m54s
2026-01-01 19:39:09 +01:00
Tobias Klemp
0938ce1270 Merge branch 'feature/branch-deployments'
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-01 19:37:30 +01:00
Tobias Klemp
0b523e75fd fix path again
Some checks failed
CI / build-and-test (push) Failing after 2m53s
2026-01-01 19:04:57 +01:00
Tobias Klemp
14170e3261 fix: path
Some checks failed
CI / build-and-test (push) Has been cancelled
2026-01-01 19:01:57 +01:00
10 changed files with 364 additions and 157 deletions

View File

@@ -0,0 +1,49 @@
name: Build docker image
description: 'builds docker image'
inputs:
tag:
description: 'Docker image tag'
required: true
REGISTRY_ACCESS_TOKEN:
description: 'Registry token to authenticate'
required: true
REGISTRY_USER:
description: 'Registry user to authenticate'
required: true
outputs:
image_url:
description: 'Full image URL that was built'
value: ${{ steps.build.outputs.image_url }}
runs:
using: 'composite'
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: ${{ inputs.REGISTRY_USER }}
password: ${{ inputs.REGISTRY_ACCESS_TOKEN }}
- name: Set repository variable
shell: bash
id: repo
run: |
REPOSITORY=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
echo "name=$REPOSITORY" >> $GITHUB_OUTPUT
- name: Build and push image
uses: docker/build-push-action@v6
with:
push: true
tags: '${{ vars.INSTANCE_URL }}/${{ steps.repo.outputs.name }}:${{ inputs.tag }}'
- name: Set output
shell: bash
run: |
echo "image_url=${{ vars.INSTANCE_URL }}/${{ steps.repo.outputs.name }}:${{ inputs.tag }}" >> $GITHUB_OUTPUT

View File

@@ -1,35 +0,0 @@
name: Build docker image
inputs:
tag:
description: 'Docker image tag'
required: true
outputs:
image_url:
description: 'Full image URL that was built'
value: ${{ steps.build.outputs.image_url }}
jobs:
build_docker:
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:${{ inputs.tag }}
- name: Set output
shell: bash
run: |
echo "image_url=${{ vars.INSTANCE_URL }}/tech-reborn/phoenix:${{ inputs.tag }}" >> $GITHUB_OUTPUT

View File

@@ -1,93 +0,0 @@
name: 'Docker Compose Deploy'
description: 'Deploy application using Docker Compose'
inputs:
compose_file:
description: 'Path to docker-compose file'
required: false
default: 'docker-compose.yml'
project_name:
description: 'Docker Compose project name'
required: true
url:
description: 'Url of the deployed application'
required: true
environment_file:
description: 'Path to environment file'
required: false
default: '.env'
image_url:
description: 'Docker image tag to deploy'
required: false
default: 'latest'
registry:
description: 'Docker registry'
required: false
default: 'git.klemp.dev'
runs:
using: 'composite'
steps:
- uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.SSH_DEPLOYMENT_KEY }}
- name: Create environment file
shell: bash
run: |
cat > ${{ inputs.environment_file }} << EOF
IMAGE_URL=${{ inputs.image_url }}
URL=${{ inputs.url }}
REGISTRY=${{ inputs.registry }}
PROJECT_NAME=${{ inputs.project_name }}
COMPOSE_PROJECT_NAME=${{ inputs.project_name }}
EOF
- name: Create Docker context
shell: bash
run: |
# Remove existing context if it exists
docker context rm deploy_target 2>/dev/null || true
# Create new Docker context
docker context create deploy_target \
--docker "host=ssh://${{ vars.ssh_user }}@${{ vars.ssh_host }}:${{ vars.ssh_port }}"
# Verify context works
docker --context deploy_target info
- name: Stop existing deployment
shell: bash
run: |
docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} down --remove-orphans || true
- name: Pull latest images
shell: bash
run: |
docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} pull
- name: Deploy with Docker Compose
id: deploy
shell: bash
run: |
# Start services
docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} up -d
# Wait for services to be healthy
echo "Waiting for services to start..."
sleep 10
# Get container names
CONTAINERS=$(docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} ps --services | tr '\n' ',' | sed 's/,$//')
echo "containers=$CONTAINERS" >> $GITHUB_OUTPUT
echo "✅ Deployment completed successfully!"
echo "🌐 URL: ${{ inputs.url }}"
echo "📦 Containers: $CONTAINERS"
- name: Show deployment status
shell: bash
run: |
echo "=== Deployment Status ==="
docker-compose --context deploy_target -f ${{ inputs.compose_file }} -p ${{ inputs.project_name }} ps
echo "========================="

View File

@@ -0,0 +1,87 @@
name: 'Docker Compose Deploy'
description: 'Deploy application using Docker Compose'
inputs:
compose_file:
description: 'Path to docker-compose file'
required: false
default: 'docker-compose.yml'
project_name:
description: 'Docker Compose project name'
required: true
url:
description: 'Url of the deployed application'
required: true
environment_file:
description: 'Path to environment file'
required: false
default: '.env'
image_url:
description: 'Docker image tag to deploy'
required: false
default: 'latest'
registry:
description: 'Docker registry'
required: false
default: 'git.klemp.dev'
deployment_key:
description: 'SSH deployment private key'
required: true
ssh_port:
description: 'SSH port'
required: true
ssh_host:
description: 'SSH host'
required: true
ssh_user:
description: 'SSH user'
required: true
runs:
using: 'composite'
steps:
- name: Get branch name
id: branch_name
uses: ./.gitea/actions/getTagSafeRef
- name: Setup SSH
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ inputs.deployment_key }}
- name: Add SSH host to known hosts
shell: bash
run: |
mkdir -p ~/.ssh
ssh-keyscan -p ${{ inputs.ssh_port }} ${{ inputs.ssh_host }} >> ~/.ssh/known_hosts
cat > .env << EOF
IMAGE_URL='${{ inputs.image_url }}'
URL='${{ inputs.url }}'
REGISTRY=git.klemp.dev
PROJECT_NAME=${{ steps.branch_name.outputs.branch_name }}
COMPOSE_PROJECT_NAME=${{ steps.branch_name.outputs.branch_name }}
EOF
docker context rm deploy_target 2>/dev/null || true
docker context create deploy_target --docker "host=ssh://${{ inputs.ssh_user }}@${{ inputs.ssh_host }}:${{ inputs.ssh_port }}"
DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.branch_name.outputs.branch_name }} down --remove-orphans || true
DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.branch_name.outputs.branch_name }} pull
DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.branch_name.outputs.branch_name }} up -d
echo "Waiting for services to start..."
sleep 10
CONTAINERS=$(DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.branch_name.outputs.branch_name }} ps --services | tr '\n' ',' | sed 's/,$//')
echo "containers=$CONTAINERS" >> $GITHUB_OUTPUT
echo "✅ Deployment completed successfully!"
echo "🌐 URL: ${{ inputs.url }}"
echo "📦 Containers: $CONTAINERS"
echo "=== Deployment Status ==="
DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.branch_name.outputs.branch_name }} ps
echo "========================="

View File

@@ -9,11 +9,40 @@ outputs:
runs: runs:
using: 'composite' using: 'composite'
steps: steps:
- name: Get PR branch info via Gitea API
if: github.event.issue.pull_request
id: pr-info
shell: bash
run: |
# Use Gitea's API endpoint
PR_URL="${{ github.event.issue.pull_request.url }}"
# Extract PR info using curl (Gitea API is similar to GitHub)
PR_INFO=$(curl -s -H "Authorization: token ${{ gitea.token }}" "${{ gitea.api_url }}/repos/${{ gitea.repository }}/pulls/${{ gitea.event.issue.number }}")
# Extract branch name from JSON response
BRANCH_NAME=$(echo "$PR_INFO" | jq -r '.head.ref')
echo "pr_branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "Found PR branch: $BRANCH_NAME"
- name: Create tag safe branch name - name: Create tag safe branch name
id: get-branch id: get-branch
shell: bash shell: bash
run: | run: |
BRANCH_NAME="${{ github.ref }}" if [[ "${{ github.event.issue.pull_request }}" != "" && "${{ github.event.issue.pull_request }}" != "null" ]]; then
# This is a PR comment - use the branch we got from API
BRANCH_NAME="${{ steps.pr-info.outputs.pr_branch }}"
echo "Using PR branch: $BRANCH_NAME"
elif [[ "${{ github.head_ref }}" != "" ]]; then
# This is a PR workflow
BRANCH_NAME="${{ github.head_ref }}"
echo "Using head ref: $BRANCH_NAME"
else
# This is a push to main/other branch
BRANCH_NAME="${{ github.ref_name }}"
echo "Using ref name: $BRANCH_NAME"
fi
# Clean the branch name for Docker tag compatibility # Clean the branch name for Docker tag compatibility
CLEAN_BRANCH=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9._-]/-/g' | tr '[:upper:]' '[:lower:]') CLEAN_BRANCH=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9._-]/-/g' | tr '[:upper:]' '[:lower:]')

View File

@@ -2,30 +2,81 @@ name: ChatOps Deploy
on: issue_comment on: issue_comment
jobs: jobs:
testing: FeatureDeployment:
# if: | if: |
# github.event.issue.pull_request && gitea.event.issue.pull_request &&
# startsWith(github.event.comment.body, '/deploy') && startsWith(gitea.event.comment.body, '/deploy')
# (github.event.comment.author_association == 'OWNER' ||
# github.event.comment.author_association == 'MEMBER')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Get tag safe branch name - name: Checkout
id: branch_name uses: actions/checkout@v4
uses: .gitea/actions/getTagSafeRef
- name: Print branch_name - name: Get branch name
run: echo "${{ steps.branch_name.outputs.branch_name }}" id: branch_name
uses: ./.gitea/actions/getTagSafeRef
# - name: Build and push image # - name: Build and push image
# id: docker_build # id: docker_build
# uses: ./.github/actions/buildDockerImage # uses: ./.gitea/actions/build
# with: # with:
# tag: ${{ steps.branch_name.outputs.branch_name }} # tag: ${{ steps.branch_name.outputs.branch_name }}
# REGISTRY_ACCESS_TOKEN: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
# REGISTRY_USER: ${{ gitea.actor }}
# - name: Deploy application - name: Create environment file
# uses: ./.github/actions/deploy run: |
# with: cat > .env << EOF
# project_name: ${{ steps.branch_name.outputs.branch_name }} TOLGEE_API_URL=${{ vars.TOLGEE_API_URL }}
# url: '${{ steps.branch_name.outputs.branch_name }}.phoenix.klemp.local' TOLGEE_API_KEY=${{ secrets.TOLGEE_API_KEY }}
# image_url: ${{ steps.docker_build.outputs.image_url }} TRANSLATION_CACHE_TTL=${{ vars.TRANSLATION_CACHE_TTL }}
EOF
- name: Deploy application
uses: ./.gitea/actions/deploy
with:
project_name: ${{ steps.branch_name.outputs.branch_name }}
url: '${{ steps.branch_name.outputs.branch_name }}.phoenix.klemp.local'
# image_url: ${{ steps.docker_bui ld.outputs.image_url }}
image_url: 'git.klemp.dev/tech-reborn/phoenix:feature-branch-deployments'
deployment_key: ${{ secrets.SSH_DEPLOYMENT_KEY }}
ssh_host: ${{ vars.ssh_host }}
ssh_port: ${{ vars.ssh_port }}
ssh_user: ${{ vars.ssh_user }}
# - 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: Validate Docker context
# run: 'docker --context deploy_target info'
# - name: Stop existing deployment
# run: |
# DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.branch_name.outputs.branch_name }} down --remove-orphans || true
# - name: Pull latest images
# run: |
# DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.branch_name.outputs.branch_name }} pull
# - name: Deploy with Docker Compose
# id: deploy
# run: |
# DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.branch_name.outputs.branch_name }} up -d
# echo "Waiting for services to start..."
# sleep 10
# CONTAINERS=$(DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.branch_name.outputs.branch_name }} ps --services | tr '\n' ',' | sed 's/,$//')
# echo "containers=$CONTAINERS" >> $GITHUB_OUTPUT
# echo "✅ Deployment completed successfully!"
# echo "🌐 URL: ${{ steps.branch_name.outputs.branch_name }}.phoenix.klemp.local"
# echo "📦 Containers: $CONTAINERS"
# - name: Show deployment status
# run: |
# echo "=== Deployment Status ==="
# DOCKER_CONTEXT=deploy_target docker compose -f docker-compose.yml -p ${{ steps.branch_name.outputs.branch_name }} ps
# echo "========================="

112
.gitea/workflows/deploy.yml Normal file
View File

@@ -0,0 +1,112 @@
name: Deploy
on:
push:
branches:
- develop
tags:
- '*'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Get branch name
id: branch_name
uses: ./.gitea/actions/getTagSafeRef
- name: Determine image tag
id: image_tag
run: |
if [[ ${{ github.ref }} == refs/tags/* ]]; then
IMAGE_TAG=${{ github.ref_name }}
ENVIRONMENT=production
elif [[ ${{ github.ref }} == refs/heads/develop ]]; then
IMAGE_TAG="develop"
ENVIRONMENT=develop
fi
echo "tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "env=$ENVIRONMENT" >> $GITHUB_OUTPUT
echo "Image tag will be: $IMAGE_TAG"
echo "env will be: $ENVIRONMENT"
- name: Build and push image
id: docker_build
uses: ./.gitea/actions/build
with:
tag: ${{ steps.image_tag.outputs.tag }}
REGISTRY_ACCESS_TOKEN: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
REGISTRY_USER: ${{ gitea.actor }}
- name: Determine URL
id: url
run: |
if [[ ${{ github.ref_type }} == "tag" ]]; then
URL="phoenix.klemp.local"
elif [[ ${{ github.ref_name }} == "develop" ]]; then
URL="develop.phoenix.klemp.local"
fi
echo "url=$URL" >> $GITHUB_OUTPUT
echo "URL will be: $URL"
- name: Setup SSH
uses: webfactory/ssh-agent@v0.9.1
with:
ssh-private-key: ${{ secrets.SSH_DEPLOYMENT_KEY }}
- name: Add SSH host to known hosts
shell: bash
run: |
mkdir -p ~/.ssh
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 "========================="

View File

@@ -1,20 +1,27 @@
version: '3.8'
networks: networks:
tolgee:
name: tolgee
external: true
default: default:
external: name: traefik-proxy
name: traefik-proxy external: true
services: services:
app: app:
image: ${IMAGE_URL} image: ${IMAGE_URL}
container_name: ${PROJECT_NAME}-app container_name: ${PROJECT_NAME}-app
restart: unless-stopped
networks: networks:
- traefik - tolgee
- internal environment:
TOLGEE_API_URL: ${TOLGEE_API_URL}
TOLGEE_API_KEY: ${TOLGEE_API_KEY}
TRANSLATION_CACHE_TTL: ${TRANSLATION_CACHE_TTL}
restart: unless-stopped
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.docker.network=traefik-proxy - traefik.docker.network=traefik-proxy
- traefik.http.routers.${PROJECT_NAME}.entrypoints=http
- traefik.http.routers.${PROJECT_NAME}.service=${PROJECT_NAME}
- traefik.http.routers.${PROJECT_NAME}.rule=Host(`${URL}`) - traefik.http.routers.${PROJECT_NAME}.rule=Host(`${URL}`)
- traefik.http.routers.${PROJECT_NAME}.tls.certresolver=letsencrypt
- traefik.http.services.${PROJECT_NAME}.loadbalancer.server.port=3000 - traefik.http.services.${PROJECT_NAME}.loadbalancer.server.port=3000

View File

@@ -64,6 +64,7 @@ class LanguageService {
protected async fetchTranslations(languageCodes: string | string[]) { protected async fetchTranslations(languageCodes: string | string[]) {
const url = new URL(`${env.TOLGEE_API_URL}/v2/projects/2/export`) const url = new URL(`${env.TOLGEE_API_URL}/v2/projects/2/export`)
console.log('Getting language data', url.toString())
url.searchParams.append('format', 'JSON') url.searchParams.append('format', 'JSON')
url.searchParams.append('zip', 'true') url.searchParams.append('zip', 'true')
@@ -76,7 +77,6 @@ class LanguageService {
if (!env.TOLGEE_API_KEY) { if (!env.TOLGEE_API_KEY) {
throw new Error('TOLGEE_API_KEY not set') throw new Error('TOLGEE_API_KEY not set')
} }
const response = await fetch(url, { const response = await fetch(url, {
method: 'GET', method: 'GET',
headers: { headers: {

View File

@@ -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
// //