it-smi
CI / Сборка (push) Failing after 4s
CI / Деплой на стейджинг (push) Skipped
CI / Проверка кода (push) Skipped
CI / Сборка (pull_request) Successful in 1m46s
CI / Деплой на стейджинг (pull_request) Failing after 2s
CI / Проверка кода (pull_request) Successful in 1m17s

This commit is contained in:
arswarog committed 2026-11-10 16:55:11 +03:00
1 parent 7d5156d92e
commit 257c044e5f
36 files changed
+27 -2080

No files matched your search

+1 -26
View File
@@ -90,7 +90,7 @@ jobs:
runs-on: ubuntu-latest
needs: build
env:
DEPLOY_URL: https://${{ github.head_ref || github.ref_name }}.jt4d.jt4d.ru.net
DEPLOY_URL: https://${{ github.head_ref || github.ref_name }}.it-smi.jt4d.ru.net
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -163,28 +163,3 @@ jobs:
- name: Lint
run: yarn lint:check
docs:
name: Документация
runs-on: ubuntu-latest
needs: build
container:
image: git.jt4d.ru/jt4d/gitea-runner:latest
credentials:
username: ${{ vars.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
volumes:
- '/usr/local/share/.cache:/usr/local/share/.cache'
env:
YARN_CACHE_FOLDER: /usr/local/share/.cache/yarn
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and deploy docs
uses: https://git.jt4d.ru/docuservix/docs@next
with:
prefix: wiki
on-broken-links: warn
-143
View File
@@ -1,143 +0,0 @@
name: Production
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'info'
type: choice
options:
- verbose
- debug
- info
- warn
concurrency:
group: production-deploy
cancel-in-progress: false
jobs:
build:
name: Сборка
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Gitea Registry
uses: docker/login-action@v3
with:
registry: git.jt4d.ru
username: ${{ vars.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Compute version
id: version
env:
REF_NAME: ${{ github.ref_name }}
run: |
VERSION=$(git describe --tags --exact-match 2>/dev/null \
|| echo "$REF_NAME-$(git rev-parse --short HEAD)")
# Единственная проверка VERSION в пайплайне: дальше он уходит и в шаги
# этого job, и в deploy-production через needs.build.outputs.version.
if ! printf '%s' "$VERSION" | grep -Eq '^[A-Za-z0-9][A-Za-z0-9.-]*$'; then
echo "::error::Недопустимый VERSION: '$VERSION'. Разрешены только A-Z a-z 0-9 . -, значение не может быть пустым и начинаться с '-'"
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "**Версия:** \`$VERSION\`" >> $GITHUB_STEP_SUMMARY
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Check migrations list
run: yarn ts-node tools/buildDataSource.ts --check
- name: Build
run: yarn build
env:
APP_VERSION: ${{ steps.version.outputs.VERSION }}
- name: Check data-source
run: yarn ts-node tools/checkDataSource.ts
- name: Build web docker image
uses: docker/build-push-action@v7
with:
context: apps/web
file: apps/web/Dockerfile
push: true
tags: git.jt4d.ru/${{ github.repository }}/web:${{ steps.version.outputs.VERSION }}
cache-from: git.jt4d.ru/${{ github.repository }}/web:master
labels: |
org.opencontainers.image.ref.name=${{ steps.version.outputs.VERSION }}
- name: Copy
run: cp yarn.lock apps/api/
- name: Build api docker image
uses: docker/build-push-action@v7
with:
context: apps/api
file: apps/api/Dockerfile
push: true
tags: git.jt4d.ru/${{ github.repository }}/api:${{ steps.version.outputs.VERSION }}
cache-from: git.jt4d.ru/${{ github.repository }}/api:master
labels: |
org.opencontainers.image.ref.name=${{ steps.version.outputs.VERSION }}
deploy-production:
name: Деплой на прод
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check log level
env:
LOG_LEVEL: ${{ inputs.logLevel }}
run: |
# VERSION проверен regexp-ом в job build (шаг Compute version) и приходит
# сюда как его output; LOG_LEVEL — свободный ввод, проверяется здесь.
case "$LOG_LEVEL" in
'' | verbose | debug | info | warn) ;;
*)
echo "::error::Недопустимый LOG_LEVEL: '$LOG_LEVEL'"
exit 1
;;
esac
- name: Deploy via SSH
uses: jt4d-lab/ssh-action@v1
env:
VERSION: ${{ needs.build.outputs.version }}
LOG_LEVEL: ${{ inputs.logLevel }}
with:
host: ${{ vars.PROD_HOST }}
username: ${{ vars.PROD_USER }}
key: ${{ secrets.PROD_SSH_PRIVATE_KEY }}
port: ${{ vars.PROD_PORT }}
workdir: /srv/jt4d
files: docker-compose.production.yml
envs: VERSION,LOG_LEVEL
script_stop: true
script: |
mv -f docker-compose.production.yml docker-compose.yml
docker-compose pull --quiet
docker-compose down
docker-compose up -d
# Ожидания готовности нет намеренно
echo "Список миграций"
docker exec jt4d_api node_modules/.bin/typeorm migration:show -d data-source.js
echo "Применение миграций"
docker exec jt4d_api node_modules/.bin/typeorm migration:run -t each -d data-source.js