@@ -2,35 +2,39 @@ name: Build, Test and Release
22
33on :
44 push :
5- branches : [ cicd ]
5+ branches : [cicd]
66 pull_request :
7- branches : [ cicd ]
7+ branches : [cicd]
88
99jobs :
1010 build-and-test :
11- name : Build and Test
12- runs-on : ubuntu-latest
13-
14- steps :
11+ name : Build and Test
12+ runs-on : ubuntu-latest
13+
14+ steps :
1515 - name : Checkout code
1616 uses : actions/checkout@v4
17-
17+
1818 - name : Set up JDK
1919 uses : actions/setup-java@v4
2020 with :
21- java-version : ' 17 '
22- distribution : ' temurin'
23- cache : ' gradle'
24-
21+ java-version : " 17 "
22+ distribution : " temurin"
23+ cache : " gradle"
24+
2525 - name : Grant execute permission for gradlew
2626 run : chmod +x gradlew
27-
27+
28+ # Добавленный шаг для форматирования
29+ - name : Format Kotlin code with ktfmt
30+ run : ./gradlew ktfmtFormat
31+
2832 - name : Build with Gradle
2933 run : ./gradlew build
30-
34+
3135 - name : Run tests
3236 run : ./gradlew test
33-
37+
3438 - name : Upload test results
3539 uses : actions/upload-artifact@v4
3640 if : always()
@@ -43,40 +47,40 @@ jobs:
4347 needs : build-and-test
4448 if : github.ref == 'refs/heads/cicd'
4549 runs-on : ubuntu-latest
46-
50+
4751 steps :
48- - name : Checkout code
49- uses : actions/checkout@v4
50-
51- - name : Set up JDK
52- uses : actions/setup-java@v4
53- with :
54- java-version : ' 17 '
55- distribution : ' temurin'
56-
57- - name : Grant execute permission for gradlew
58- run : chmod +x gradlew
59-
60- - name : Build with Gradle
61- run : ./gradlew build
62-
63- - name : Get version from build
64- id : version
65- run : |
66- VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')
67- echo "version=$VERSION" >> $GITHUB_OUTPUT
68-
69- - name : Create Release
70- uses : softprops/action-gh-release@v1
71- env :
72- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
73- with :
74- tag_name : v${{ steps.version.outputs.version }}
75- name : Release v${{ steps.version.outputs.version }}
76- body : |
77- Automatic release created by GitHub Actions
78- Version: ${{ steps.version.outputs.version }}
79- draft : false
80- prerelease : false
81- files : |
82- build/libs/*.jar
52+ - name : Checkout code
53+ uses : actions/checkout@v4
54+
55+ - name : Set up JDK
56+ uses : actions/setup-java@v4
57+ with :
58+ java-version : " 17 "
59+ distribution : " temurin"
60+
61+ - name : Grant execute permission for gradlew
62+ run : chmod +x gradlew
63+
64+ - name : Build with Gradle
65+ run : ./gradlew build
66+
67+ - name : Get version from build
68+ id : version
69+ run : |
70+ VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')
71+ echo "version=$VERSION" >> $GITHUB_OUTPUT
72+
73+ - name : Create Release
74+ uses : softprops/action-gh-release@v1
75+ env :
76+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
77+ with :
78+ tag_name : v${{ steps.version.outputs.version }}
79+ name : Release v${{ steps.version.outputs.version }}
80+ body : |
81+ Automatic release created by GitHub Actions
82+ Version: ${{ steps.version.outputs.version }}
83+ draft : false
84+ prerelease : false
85+ files : |
86+ build/libs/*.jar
0 commit comments