forked from bttv-android/bttv
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (123 loc) · 4.86 KB
/
ci.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: build
on:
push:
tags:
- "v*"
pull_request:
paths-ignore:
- "README.md"
- "architecture.md"
- 'CHANGELOG.md'
- 'CONTRIBUTING.md'
branches-ignore:
- 'bttv/l10n_master'
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
# checkout current state of repo
- uses: actions/checkout@v3
# set env variables
- name: set variables
run: |
echo 'APK_URL=https://www.apkmirror.com/wp-content/themes/APKMirror/download.php?id=5124464&key=69bd3978e00715187747c705c92630ecad72ea19&forcebaseapk=true' >> $GITHUB_ENV
# get keystore.kjs from secret
- name: create keystore.kjs from secret
run: echo "${{ secrets.KEYSTORE }}" | base64 -d > keystore.jks
# download apk when cache miss
- name: download base
if: steps.apk-cache.outputs.cache-hit != 'true'
run: wget --user-agent="Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Mobile Safari/537.36" '${{ env.APK_URL }}' -O twitch.apk
- name: Create bttv directory
run: mkdir -p /opt/bttv
- name: Set git identity
run: |
git config --global user.email "<>"
git config --global user.name "bttv-android"
- name: Install SDK Tools
run: |
wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
unzip commandlinetools-linux-6858069_latest.zip
rm commandlinetools-linux-6858069_latest.zip
echo "y" | cmdline-tools/bin/sdkmanager --sdk_root=/opt/android-sdk-linux "build-tools;30.0.0"
- name: Install APKTool
run: |
wget https://github.com/iBotPeaches/Apktool/releases/download/v2.5.0/apktool_2.5.0.jar
mv apktool_2.5.0.jar /opt/bttv/apktool_2.5.0.jar
- name: Install Uber APK Signer
run: |
wget https://github.com/patrickfav/uber-apk-signer/releases/download/v1.2.1/uber-apk-signer-1.2.1.jar
mv uber-apk-signer-1.2.1.jar /opt/bttv/uber-apk-signer-1.2.1.jar
- name: Install Smali
run: |
wget https://bitbucket.org/JesusFreke/smali/downloads/baksmali-2.4.0.jar
mv baksmali-2.4.0.jar /opt/bttv/baksmali-2.4.0.jar
- name: Install Build Companion
run: |
wget https://github.com/bttv-android/build-companion/releases/download/v5.2.0/build-companion
shasum build-companion
chmod +x build-companion
mv build-companion /opt/bttv/build-companion
- name: Disable long-lived gradle daemon
run: |
mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
- name: Set env variables
run: |
echo "ANDROID_SDK_HOME=/opt/android-sdk-linux" >> $GITHUB_ENV
echo "ANDROID_SDK_ROOT=/opt/android-sdk-linux" >> $GITHUB_ENV
echo "ANDROID_HOME=/opt/android-sdk-linux" >> $GITHUB_ENV
echo "ANDROID_SDK=/opt/android-sdk-linux" >> $GITHUB_ENV
echo "PATH=$PATH:/opt/bttv" >> $GITHUB_ENV
# build apk
- name: build apk
run: ./initworkspace
# print checksums so anybody can confirm legitimacy of their apk
- name: print checksums
run: cp ./disass/dist/twitch.apk bttv.apk && shasum *.apk
# send to other release job if needed
- uses: actions/upload-artifact@v2
if: ${{ github.event_name != 'pull_request' }}
with:
name: bttv-apk
path: bttv.apk
retention-days: 1
release:
needs: build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get CHANGELOGA
id: changelog
run: |
echo "RELEASE_BODY<<EOF" > /tmp/bttv &&
head -n25 CHANGELOG.md >> /tmp/bttv &&
echo "EOF" >> /tmp/bttv &&
cat /tmp/bttv >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v2
with:
name: bttv-apk
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{ steps.changelog.outputs.RELEASE_BODY }}
draft: true
prerelease: false
- id: version_tag
run: echo "version_tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: upload Release Apk
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bttv.apk
asset_name: bttv-${{ steps.version_tag.outputs.version_tag }}.apk
asset_content_type: application/vnd.android.package-archive