forked from Pixel-Props/build.prop
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (90 loc) · 3.75 KB
/
build-on-schedule.yml
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
101
102
103
104
name: Build props (on schedule)
on:
workflow_dispatch:
schedule:
- cron: "37 13 7 * *" # At 13:37 on day-of-month 7. (UTC)
jobs:
prepare_build:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
id: ${{ steps.create_release.outputs.id }}
steps:
- name: Determine tag name
id: get_tag_name
run: |
echo "tag_name=$(date '+%Y%m%d')" >> $GITHUB_OUTPUT
echo "friendly_tag_name=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Create a release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_tag_name.outputs.tag_name }}
release_name: ${{ steps.get_tag_name.outputs.friendly_tag_name }}
draft: false
prerelease: false
build:
name: Build props
needs: prepare_build
strategy:
matrix:
# Devices to build props for
device_name: [cheetah, raven, redfin]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install APT packages
uses: daaku/gh-action-apt-install@v4
with:
packages: dos2unix python3 python3-pip zip
- name: Install protobuf
run: |
pip install --upgrade pip
pip3 install -Iv protobuf==3.20.3
- name: Make all scripts executable
run: chmod +x *.sh
- name: Download latest OTA build for ${{ matrix.device_name }}
run: ./download_latest_ota_build.sh ${{ matrix.device_name }}
- name: Extract images and build
id: extract_and_build
run: ./extract_images.sh
- name: Upload files to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare_build.outputs.upload_url }}
asset_path: ./${{ steps.extract_and_build.outputs.module_base_name }}.zip
asset_name: ${{ steps.extract_and_build.outputs.module_base_name }}.zip
asset_content_type: application/zip
- name: Add information to release
uses: irongut/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: ${{ needs.prepare_build.outputs.id }}
replacebody: false
body: |
## ${{ steps.extract_and_build.outputs.device_name }} (${{ steps.extract_and_build.outputs.device_code_name_title }})
#### Module
- File name: `${{ steps.extract_and_build.outputs.module_base_name }}.zip`
- File hash (SHA256): `${{ steps.extract_and_build.outputs.module_hash }}`
#### Firmware
- Build ID: `${{ steps.extract_and_build.outputs.device_build_id }}`
- Android version: `${{ steps.extract_and_build.outputs.device_build_android_version }}`
- Security patch: `${{ steps.extract_and_build.outputs.device_build_security_patch }}`
- name: Send to Telegram
run: |
{
echo '${{ steps.extract_and_build.outputs.device_name }} - ${{ steps.extract_and_build.outputs.device_code_name_title }}';
echo 'Security Patch: ${{ steps.extract_and_build.outputs.device_build_security_patch }}';
echo 'ID: ${{ steps.extract_and_build.outputs.device_build_id }}';
} > .tg_caption
curl -X POST "https://api.telegram.org/bot${{ secrets.BOT_TOKEN }}/sendDocument" \
-H "Content-Type: multipart/form-data" \
-F "chat_id=${{ secrets.CHANNEL_ID }}" \
-F "document=@${{ steps.extract_and_build.outputs.module_base_name }}.zip;type=application/zip" \
-F "caption=$(cat .tg_caption)"