-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (90 loc) · 2.78 KB
/
build.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
name: Build APK
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
repository_dispatch:
env:
APK_NAME: UNNAMED # Change to your apk name
RELEASE_REPO: CHANGE/ME/PLZ # e.g. shacha086/APKPatcher
ASSETS: assets # This is the folder which to be packed
jobs:
check:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.valid.outputs.status }}
steps:
- name: Check push valid
id: valid
if: contains( github.event.commits[0].message, 'Commit from GitHub Actions' ) == true
run: |
echo "::set-output name=status::skipped"
build:
runs-on: ubuntu-latest
needs: check
if: ${{ needs.check.outputs.status != 'skipped' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.ACCESS_TOKEN }}
submodules: 'recursive'
- name: Set up Apksigner
run: |
sudo apt update
sudo apt install apksigner -y
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Set up workspace
run: |
mkdir ./works
- name: Update submodules
run: |
git submodule foreach git submodule sync --recursive
git submodule foreach git submodule update --recursive --remote
- name: Merge assets into apk
run: |
cp ./Blueprint.apk ./works/$APK_NAME-unsigned.apk
zip -g -0 ./works/$APK_NAME-unsigned.apk $ASSETS -r
- name: Print content in zip
run: |
cd ./works
unzip -l ./$APK_NAME-unsigned.apk
- name: Get sign key
run: |
cd ./works
echo -n "${{ secrets.KEYSTORE_B64 }}" | base64 --decode > $APK_NAME.jks
- name: Sign apk
env:
KEYSTORE_NAME: ./$APK_NAME.jks
KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}
ALIAS_PASS: ${{ secrets.ALIAS_PASS }}
INPUT: ./$APK_NAME-unsigned.apk
OUTPUT: ./$APK_NAME.apk
run: |
cd ./works
rm -f ./sign.sh
echo -e "#"\!"/bin/bash""\napksigner sign --ks $KEYSTORE_NAME --in $INPUT --out $OUTPUT <<EOF\n$KEYSTORE_PASS\n$ALIAS_PASS\nEOF" >> sign.sh
chmod +x sign.sh
./sign.sh
- name: Get version and update version
run: |
python ./updateVersion.py
- name: Release
uses: Hs1r1us/Release-AIO@v1.0
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: $APK_NAME v${{ env.VERSION }}
body: ${{ github.event.commits[0].message }}
asset_files: ./works/$APK_NAME.apk
repo: $RELEASE_REPO
- name: Clean up
run: |
rm -r ./works/*
- name: Add & Commit
uses: EndBug/add-and-commit@v9.0.0