CI: unified admin build (same-origin), sha-* tags and stage promote.

This commit is contained in:
2026-07-09 23:04:53 +03:00
parent 95846bde1e
commit f506ed4f95
4 changed files with 38 additions and 20 deletions
+2 -2
View File
@@ -1,3 +1,3 @@
VITE_API_BASE_URL=https://admin-api.stage.eventhub.local # Production: API/WS через nginx в контейнере (same-origin, как на IFT).
VITE_WS_URL=wss://admin-ws.stage.eventhub.local VITE_API_BASE_URL=
VITE_APP_TITLE=EventHub Admin VITE_APP_TITLE=EventHub Admin
+11 -2
View File
@@ -5,12 +5,19 @@ on:
branches: [master, main] branches: [master, main]
workflow_dispatch: workflow_dispatch:
env:
REGISTRY: git.sabilin.com/eventhub
jobs: jobs:
deploy-ift-admin: deploy-ift-admin:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Compute image tag
id: meta
run: echo "tag=sha-${GITHUB_SHA::12}" >> "$GITHUB_OUTPUT"
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: '20'
@@ -34,7 +41,9 @@ jobs:
with: with:
context: . context: .
push: true push: true
tags: git.sabilin.com/eventhub/eventhub-admin-ui:ift tags: |
${{ env.REGISTRY }}/eventhub-admin-ui:${{ steps.meta.outputs.tag }}
${{ env.REGISTRY }}/eventhub-admin-ui:ift
- name: Deploy admin on IFT via SSH - name: Deploy admin on IFT via SSH
uses: appleboy/ssh-action@v0.1.5 uses: appleboy/ssh-action@v0.1.5
@@ -45,4 +54,4 @@ jobs:
script: | script: |
export REGISTRY_USER='${{ secrets.REGISTRY_USER }}' export REGISTRY_USER='${{ secrets.REGISTRY_USER }}'
export REGISTRY_PASSWORD='${{ secrets.REGISTRY_PASSWORD }}' export REGISTRY_PASSWORD='${{ secrets.REGISTRY_PASSWORD }}'
/opt/eventhub-ift/devops/scripts/deploy-service.sh ift admin /opt/eventhub-ift/devops/scripts/deploy-service.sh ift admin ${{ steps.meta.outputs.tag }}
+23 -15
View File
@@ -6,19 +6,20 @@ on:
- 'v*' - 'v*'
workflow_dispatch: workflow_dispatch:
env:
REGISTRY: git.sabilin.com/eventhub
jobs: jobs:
deploy-stage-admin: deploy-stage-admin:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-node@v4 - name: Compute image tags
with: id: meta
node-version: '20' run: |
cache: 'npm' echo "sha_tag=sha-${GITHUB_SHA::12}" >> "$GITHUB_OUTPUT"
echo "release_tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- run: npm ci
- run: npm run build
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
@@ -30,13 +31,20 @@ jobs:
username: ${{ secrets.REGISTRY_USER }} username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push admin-ui - name: Promote admin-ui image (no rebuild)
uses: docker/build-push-action@v4 run: |
with: set -euo pipefail
context: . SHA="${{ steps.meta.outputs.sha_tag }}"
push: true REL="${{ steps.meta.outputs.release_tag }}"
tags: git.sabilin.com/eventhub/eventhub-admin-ui:stage if ! docker buildx imagetools inspect "${REGISTRY}/eventhub-admin-ui:${SHA}" >/dev/null 2>&1; then
echo "Образ eventhub-admin-ui:${SHA} не найден."
echo "Сначала прогоните IFT deploy для этого коммита (push в master)."
exit 1
fi
docker buildx imagetools create \
-t "${REGISTRY}/eventhub-admin-ui:${REL}" \
-t "${REGISTRY}/eventhub-admin-ui:stage" \
"${REGISTRY}/eventhub-admin-ui:${SHA}"
# Stage admin stack — когда появится stage/docker-compose.admin.yml
- name: Note - name: Note
run: echo "Образ :stage опубликован. Admin stack на stage — отдельный шаг." run: echo "Образ :${{ steps.meta.outputs.release_tag }} опубликован. Admin stack на stage — когда появится stage/docker-compose.admin.yml."
+1
View File
@@ -6,6 +6,7 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc -b && vite build", "build": "tsc -b && vite build",
"build:ift": "npm run build",
"lint": "eslint .", "lint": "eslint .",
"preview": "vite preview" "preview": "vite preview"
}, },