-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (85 loc) · 3.28 KB
/
dev.yml
File metadata and controls
100 lines (85 loc) · 3.28 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Dev Build & Telegram
on:
push:
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
cache: true
- name: Get dependencies
run: flutter pub get
- name: Restore keystore
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/app/keystore.jks
cat > android/key.properties << EOF
storePassword=${{ secrets.STORE_PASSWORD }}
keyPassword=${{ secrets.KEY_PASSWORD }}
keyAlias=${{ secrets.KEY_ALIAS }}
storeFile=keystore.jks
EOF
- name: Build APKs (split by ABI)
run: flutter build apk --release --split-per-abi
- name: Rename APKs
run: |
mkdir -p dist
cp build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk dist/time_machine-armeabi-v7a-dev.apk
cp build/app/outputs/flutter-apk/app-arm64-v8a-release.apk dist/time_machine-arm64-v8a-dev.apk
cp build/app/outputs/flutter-apk/app-x86_64-release.apk dist/time_machine-x86_64-dev.apk
- name: Get commit info
id: commit
run: |
echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
- name: Send build notification
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: "Dev Build | ${{ steps.commit.outputs.hash }} | ${{ steps.commit.outputs.message }}"
- name: Send armeabi-v7a APK
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
document: dist/time_machine-armeabi-v7a-dev.apk
- name: Send arm64-v8a APK
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
document: dist/time_machine-arm64-v8a-dev.apk
- name: Send x86_64 APK
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
document: dist/time_machine-x86_64-dev.apk
- name: Upload to Cloudflare R2
env:
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
AWS_EC2_METADATA_DISABLED: "true"
# 关闭 aws-cli v2 默认的完整性校验,避免 R2 拒绝带 checksum 头的请求
AWS_REQUEST_CHECKSUM_CALCULATION: when_required
AWS_RESPONSE_CHECKSUM_VALIDATION: when_required
run: |
for f in time_machine-arm64-v8a-dev.apk time_machine-x86_64-dev.apk; do
aws s3 cp "dist/$f" \
"s3://${{ secrets.R2_BUCKET }}/time_machine/$f" \
--endpoint-url "${{ secrets.R2_ENDPOINT }}"
done