Skip to content

Commit 12b4148

Browse files
.
1 parent f54c6ca commit 12b4148

1 file changed

Lines changed: 28 additions & 45 deletions

File tree

.github/workflows/cicd.yaml

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,35 @@
1-
name: Build, Test and Release
1+
name: Android Build and Release
22

33
on:
44
push:
5-
branches: [cicd]
6-
pull_request:
7-
branches: [cicd]
5+
tags: ['v*'] # Запускать при создании тега v1.0, v2.0 и т.д.
86

97
jobs:
10-
create-release:
11-
name: Create Release
8+
build:
129
runs-on: ubuntu-latest
13-
10+
1411
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v4
17-
18-
- name: Set up JDK
19-
uses: actions/setup-java@v4
20-
with:
21-
java-version: "17"
22-
distribution: "temurin"
23-
24-
- name: Grant execute permission for gradlew
25-
run: chmod +x gradlew
26-
27-
- name: Format Kotlin code with ktfmt
28-
run: ./gradlew ktfmtFormat
29-
30-
- name: Build with Gradle
31-
run: ./gradlew build
32-
33-
- name: Get version from build
34-
id: version
35-
run: |
36-
VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')
37-
echo "version=$VERSION" >> $GITHUB_OUTPUT
38-
39-
- name: Create Release
40-
uses: softprops/action-gh-release@v1
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
with:
44-
tag_name: v${{ steps.version.outputs.version }}
45-
name: Release v${{ steps.version.outputs.version }}
46-
body: |
47-
Automatic release created by GitHub Actions
48-
Version: ${{ steps.version.outputs.version }}
49-
draft: false
50-
prerelease: false
51-
files: |
52-
build/libs/*.jar
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up JDK
15+
uses: actions/setup-java@v3
16+
with:
17+
java-version: '17'
18+
distribution: 'temurin'
19+
20+
- name: Build Release APK
21+
run: |
22+
chmod +x gradlew
23+
./gradlew assembleRelease
24+
25+
- name: Upload APK
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: app-release
29+
path: app/build/outputs/apk/release/*.apk
30+
31+
- name: Create Release
32+
uses: softprops/action-gh-release@v1
33+
if: startsWith(github.ref, 'refs/tags/')
34+
with:
35+
files: app/build/outputs/apk/release/*.apk

0 commit comments

Comments
 (0)