-
-
Notifications
You must be signed in to change notification settings - Fork 69
71 lines (61 loc) · 2.25 KB
/
androidci.yml
File metadata and controls
71 lines (61 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Android CI
on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
build:
name: Build APKs
runs-on: ubuntu-latest
strategy:
matrix:
build-type: [release]
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Prepare token.properties file
run: |
if [ -f "$GITHUB_WORKSPACE/token.properties" ]; then
rm $GITHUB_WORKSPACE/token.properties
fi
echo "VCSPACE_TOKEN=${{ secrets.VCSPACE_TOKEN }}" >> $GITHUB_WORKSPACE/token.properties
echo "CLIENT_SECRET=${{ secrets.CLIENT_SECRET }}" >> $GITHUB_WORKSPACE/token.properties
echo "CLIENT_ID=${{ secrets.CLIENT_ID }}" >> $GITHUB_WORKSPACE/token.properties
echo "OAUTH_REDIRECT_URL=${{ secrets.OAUTH_REDIRECT_URL }}" >> $GITHUB_WORKSPACE/token.properties
- name: Debug token.properties creation
run: ls -la $GITHUB_WORKSPACE
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Give permission to executable
run: chmod +x gradlew
- name: Generate APK
run: ./gradlew assemble${{ matrix.build-type }}
- name: Upload APK
uses: actions/upload-artifact@master
with:
name: app-${{ matrix.build-type }}
path: app/build/outputs/apk/${{ matrix.build-type }}/app-${{ matrix.build-type }}.apk
- name: Send APK to Telegram
if: matrix.build-type == 'release' && github.event_name != 'pull_request'
continue-on-error: true
run: |
curl -X POST "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendDocument" \
-F chat_id="${{ secrets.CHAT_ID }}" \
-F message_thread_id="${{ secrets.RELEASE_TOPIC_ID }}" \
-F caption="${{ github.event.head_commit.message }} by ${{ github.actor }}" \
-F document=@"app/build/outputs/apk/release/app-release.apk"