-
Notifications
You must be signed in to change notification settings - Fork 4
135 lines (115 loc) · 4.58 KB
/
create-release.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
name: Create Release Assets
on:
workflow_dispatch:
workflow_call:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Dart SDK
uses: dart-lang/[email protected]
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Install Apktool
run: |
wget "https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool"
wget "https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.4.1.jar"
mv apktool_2.4.1.jar apktool.jar
sudo cp apktool /usr/local/bin
sudo cp apktool.jar /usr/local/bin
sudo chmod +x /usr/local/bin/apktool
sudo chmod +x /usr/local/bin/apktool.jar
- name: Verify Apktool Installation
run: apktool --version
- name: Install Android SDK
run: |
wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
mkdir -p $HOME/android-sdk/cmdline-tools
unzip commandlinetools-linux-7583922_latest.zip -d $HOME/android-sdk/cmdline-tools
mv $HOME/android-sdk/cmdline-tools/cmdline-tools $HOME/android-sdk/cmdline-tools/latest
echo "export ANDROID_SDK_ROOT=$HOME/android-sdk" >> $GITHUB_ENV
echo "export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH" >> $GITHUB_ENV
yes | sdkmanager --sdk_root=$ANDROID_SDK_ROOT --install "build-tools;30.0.3"
- name: Verify apksigner Installation
run: |
apksigner --version
- name: Cache gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build APK
run: ./gradlew assembleRelease --stacktrace
- name: Sign APK
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.KEYSTORE_BASE64 }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
# override default build-tools version (29.0.3) -- optional
BUILD_TOOLS_VERSION: "34.0.0"
- uses: kaisugi/[email protected]
id: regex-match
with:
text: ${{ github.ref }}
regex: '(v*-pre*)'
flags: gm
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: ${{ steps.regex-match.outputs.match != '' }}
- name: Set asset_name
id: set_asset_name
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "::set-output name=asset_tag::$TAG_NAME"
- name: Upload APK Universal Asset
id: upload-release-asset-universal-apk
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app/build/outputs/apk/release/app-release-unsigned-signed.apk
asset_name: pokey-universal-${{ steps.set_asset_name.outputs.asset_tag }}.apk
asset_content_type: application/zip
- name: Get Zap.Store latest release
id: get-zap-store-release
run: |
LATEST_RELEASE=$(curl -s https://api.github.com/repos/zapstore/zapstore-cli/releases/latest)
TAG_NAME=$(echo $LATEST_RELEASE | jq -r .tag_name)
echo "Latest release tag: $TAG_NAME"
echo "::set-output name=zapstore_version::$TAG_NAME"
- name: Publish to Zap.Store
id: publish-zap-store
env:
NSEC: ${{ secrets.POKEY_NSEC }}
run: |
mkdir /home/runner/.zapstore
git clone https://github.com/zapstore/zapstore-cli.git
cd zapstore-cli
git fetch --tags
git checkout ${{ steps.get-zap-store-release.outputs.zapstore_version }}
dart pub get
dart compile exe lib/main.dart -o build
cd $GITHUB_WORKSPACE
./zapstore-cli/build publish pokey