Skip to content
This repository was archived by the owner on Dec 7, 2025. It is now read-only.

Merge pull request #39 from justgithubaccount/feat/test-full-ci-v14 #14

Merge pull request #39 from justgithubaccount/feat/test-full-ci-v14

Merge pull request #39 from justgithubaccount/feat/test-full-ci-v14 #14

Workflow file for this run

name: Build and Release
on:
push:
branches: [main]
paths:
- 'apps/chat/**'
- '.github/workflows/release.yaml'
- '.releaserc.json'
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
# 1. Определяем версию БЕЗ создания релиза
- name: Get Next Version
id: version
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 21
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 2. Создаем релиз (только если есть новая версия)
- name: Semantic Release
id: semantic
if: steps.version.outputs.new_release_version
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 21
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 3. Docker build с версией (только если релиз создан)
- name: Log in to GitHub Container Registry
if: steps.semantic.outputs.new_release_published == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
if: steps.semantic.outputs.new_release_published == 'true'
uses: docker/build-push-action@v5
with:
context: ./apps/chat
push: true
tags: |
ghcr.io/justgithubaccount/chat-api:latest
ghcr.io/justgithubaccount/chat-api:${{ github.sha }}
ghcr.io/justgithubaccount/chat-api:${{ steps.semantic.outputs.new_release_version }}
# https://github.com/docker/build-push-action/tree/v5/?tab=readme-ov-file#customizing
# cache-from: type=gha
# cache-to: type=gha,mode=max