Skip to content

Commit b3f4654

Browse files
committed
Refactor build workflow to include notification step
1 parent b61dc41 commit b3f4654

File tree

1 file changed

+84
-68
lines changed

1 file changed

+84
-68
lines changed

.github/workflows/build.yml

Lines changed: 84 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,85 @@
11
on:
2-
push:
3-
branches:
4-
- main
5-
6-
jobs:
7-
build:
8-
runs-on: ubuntu-latest
9-
10-
steps:
11-
- uses: actions/checkout@v4
12-
13-
- name: set up JDK 19
14-
uses: actions/setup-java@v4
15-
with:
16-
java-version: '19'
17-
distribution: 'temurin'
18-
cache: gradle
19-
20-
- uses: oven-sh/setup-bun@v2
21-
22-
- name: Restore Gradle cache
23-
uses: actions/cache@v3
24-
with:
25-
path: |
26-
~/.gradle/caches
27-
~/.gradle/wrapper
28-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
29-
restore-keys: |
30-
${{ runner.os }}-gradle-
31-
32-
- name: Restore Android build outputs cache
33-
uses: actions/cache@v3
34-
with:
35-
path: |
36-
android/.gradle
37-
android/app/build
38-
key: ${{ runner.os }}-android-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
39-
restore-keys: |
40-
${{ runner.os }}-android-build-
41-
42-
- name: Install npm dependencies with bun
43-
run: bun install
44-
45-
- name: Grant execute permission for gradlew
46-
run: cd android && chmod +x gradlew
47-
48-
- name: Build Android Release
49-
run: cd android && ./gradlew assembleRelease
50-
51-
- name: send telegram message on push
52-
uses: appleboy/telegram-action@master
53-
with:
54-
to: ${{ secrets.TELEGRAM_TO }}
55-
token: ${{ secrets.TELEGRAM_TOKEN }}
56-
message_file: android/app/build/outputs/apk/release/Tech_Triangle-arm64-v8a.apk
57-
message: |
58-
${{ github.actor }} created commit:
59-
Commit message: ${{ github.event.commits[0].message }}
60-
61-
Repository: ${{ github.repository }}
62-
63-
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
64-
65-
- name: Upload Artifact
66-
uses: actions/upload-artifact@v4
67-
with:
68-
name: tech-triangle
69-
path: android/app/build/outputs/apk/release/Tech_Triangle-arm64-v8a.apk
2+
name: Build and Notify
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: set up JDK 19
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '19'
20+
distribution: 'temurin'
21+
cache: gradle
22+
23+
- uses: oven-sh/setup-bun@v2
24+
25+
- name: Restore Gradle cache
26+
uses: actions/cache@v3
27+
with:
28+
path: |
29+
~/.gradle/caches
30+
~/.gradle/wrapper
31+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
32+
restore-keys: |
33+
${{ runner.os }}-gradle-
34+
35+
- name: Restore Android build outputs cache
36+
uses: actions/cache@v3
37+
with:
38+
path: |
39+
android/.gradle
40+
android/app/build
41+
key: ${{ runner.os }}-android-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
42+
restore-keys: |
43+
${{ runner.os }}-android-build-
44+
45+
- name: Install npm dependencies with bun
46+
run: bun install
47+
48+
- name: Grant execute permission for gradlew
49+
run: cd android && chmod +x gradlew
50+
51+
- name: Build Android Release
52+
run: cd android && ./gradlew assembleRelease
53+
54+
- name: Upload Artifact
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: tech-triangle
58+
path: android/app/build/outputs/apk/release/Tech_Triangle-arm64-v8a.apk
59+
60+
notify:
61+
runs-on: ubuntu-latest
62+
needs: build
63+
64+
steps:
65+
- uses: actions/checkout@v4
66+
67+
- name: Download Artifact
68+
uses: actions/download-artifact@v4
69+
with:
70+
name: tech-triangle
71+
path: android/app/build/outputs/apk/release
72+
73+
- name: send telegram message on push
74+
uses: appleboy/telegram-action@master
75+
with:
76+
to: ${{ secrets.TELEGRAM_TO }}
77+
token: ${{ secrets.TELEGRAM_TOKEN }}
78+
message_file: android/app/build/outputs/apk/release/Tech_Triangle-arm64-v8a.apk
79+
message: |
80+
${{ github.actor }} created commit:
81+
Commit message: ${{ github.event.commits[0].message }}
82+
83+
Repository: ${{ github.repository }}
84+
85+
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}

0 commit comments

Comments
 (0)