Skip to content

Commit 01d351b

Browse files
committed
add nightly-build action
1 parent b125a9b commit 01d351b

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Nightly Build
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *' # once a day
6+
7+
jobs:
8+
evaluateChanges:
9+
name: Evaluate changes for run or skipping nightly build
10+
runs-on: ubuntu-latest
11+
outputs:
12+
SHOULD_BUILD: ${{ steps.check.outputs.shouldBuild }}
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 1
17+
18+
- name: Check
19+
id: check
20+
run: |
21+
if [[ $(git rev-list --after="24 hours" master) ]]; then
22+
echo ::set-output name=shouldBuild::false
23+
else
24+
echo ::set-output name=shouldBuild::true
25+
fi
26+
27+
- name: Print evaluation result
28+
run: echo ${{steps.check.outputs.shouldBuild}}
29+
30+
nightlyBuild:
31+
name: Generate Nightly Build
32+
runs-on: ubuntu-latest
33+
needs: evaluateChanges
34+
if: ${{needs.evaluateChanges.outputs.SHOULD_BUILD}}
35+
steps:
36+
- uses: actions/checkout@v2
37+
with:
38+
fetch-depth: 1
39+
40+
- name: set up JDK
41+
uses: actions/setup-java@v2
42+
with:
43+
java-version: '11'
44+
distribution: 'adopt'
45+
cache: gradle
46+
47+
- name: Decode google-services.json
48+
env:
49+
FIREBASE_SECRET: ${{ secrets.FIREBASE_SECRET }}
50+
run: echo $FIREBASE_SECRET > ${{ github.workspace }}/app/google-services.json
51+
52+
- name: Build Apk
53+
run: ./gradlew assembleProductionDebug --stacktrace
54+
55+
- name: Finding Apk
56+
id: apk_finder
57+
run: echo ::set-output name=APK_PATH::`find . -type f -iname *.apk`
58+
59+
- name: Send Apk in Telegram
60+
uses: appleboy/[email protected]
61+
with:
62+
to: ${{ secrets.TELEGRAM_TO }}
63+
token: ${{ secrets.TELEGRAM_TOKEN }}
64+
document: ${{ steps.apk_finder.outputs.APK_PATH }}

0 commit comments

Comments
 (0)