chore(ci): улучшил конфигурацию CI/CD пайплайнов

This commit is contained in:
skettiks
2026-05-03 12:04:29 +03:00
parent 1795064710
commit 1e2625a460
3 changed files with 22 additions and 11 deletions
+9 -5
View File
@@ -12,6 +12,8 @@ jobs:
name: Build & Test name: Build & Test
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 20 timeout-minutes: 20
permissions:
contents: read
outputs: outputs:
artifact-name: ${{ steps.meta.outputs.artifact-name }} artifact-name: ${{ steps.meta.outputs.artifact-name }}
steps: steps:
@@ -28,23 +30,25 @@ jobs:
- name: Set up Gradle - name: Set up Gradle
uses: gradle/actions/setup-gradle@v6 uses: gradle/actions/setup-gradle@v6
- name: Build - name: Run CI quality gate
run: ./gradlew clean bootJar --stacktrace --no-daemon run: ./gradlew clean check bootJar --stacktrace --no-daemon
- name: Test
run: ./gradlew test --stacktrace --no-daemon
- name: Set artifact name - name: Set artifact name
id: meta id: meta
run: echo "artifact-name=build-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT" run: echo "artifact-name=build-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT"
- name: Upload build artifacts - name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7
with: with:
name: ${{ steps.meta.outputs.artifact-name }} name: ${{ steps.meta.outputs.artifact-name }}
path: | path: |
build/libs/*.jar build/libs/*.jar
build/reports/detekt/**
build/reports/ktlint/**
build/reports/jacoco/**
build/reports/** build/reports/**
build/test-results/** build/test-results/**
build/jacoco/**
retention-days: 7 retention-days: 7
if-no-files-found: error if-no-files-found: error
+6 -3
View File
@@ -30,13 +30,16 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4 uses: docker/setup-buildx-action@v4
- name: Validate Dockerfile - name: Build image (no push)
if: inputs.push == false if: inputs.push == false
uses: docker/build-push-action@v7 uses: docker/build-push-action@v7
with: with:
context: . context: .
file: ./Containerfile file: ./Containerfile
call: check push: false
provenance: false
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Log in to GHCR - name: Log in to GHCR
if: inputs.push == true if: inputs.push == true
@@ -65,7 +68,7 @@ jobs:
uses: docker/build-push-action@v7 uses: docker/build-push-action@v7
with: with:
context: . context: .
file: ./Dockerfile file: ./Containerfile
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
+4
View File
@@ -29,9 +29,13 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }} GH_REPO: ${{ github.repository }}
run: | run: |
if gh release view "${{ inputs.version }}" >/dev/null 2>&1; then
echo "Release ${{ inputs.version }} already exists. Skipping creation."
else
gh release create "${{ inputs.version }}" \ gh release create "${{ inputs.version }}" \
--generate-notes \ --generate-notes \
--title "${{ inputs.version }}" --title "${{ inputs.version }}"
fi
- name: Send Telegram notification - name: Send Telegram notification
env: env: