This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
forked from mollyim/mollyim-android
-
Notifications
You must be signed in to change notification settings - Fork 5
101 lines (84 loc) · 3.12 KB
/
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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-[0-9]+.up[0-9]+'
env:
HAVE_RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE != '' }}
jobs:
build:
name: Build
if: "github.event.base_ref == 'refs/heads/main'"
runs-on: ubuntu-22.04
env:
GRADLE_OPTS: "-Dorg.gradle.project.kotlin.compiler.execution.strategy=in-process"
CI_MAPS_API_KEY: ${{ secrets.MAPS_API_KEY }}
steps:
- uses: actions/checkout@v3
- name: Set up builder image
run: docker-compose build
working-directory: reproducible-builds
- name: Extract release keys
if: "env.HAVE_RELEASE_KEYSTORE == 'true'"
run: printenv RELEASE_KEYSTORE | base64 -d > certs/release.jks
working-directory: reproducible-builds
env:
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
- name: Build release
if: "env.HAVE_RELEASE_KEYSTORE == 'false'"
run: docker-compose --env-file ci/release.env run assemble
working-directory: reproducible-builds
- name: Build and sign release
if: "env.HAVE_RELEASE_KEYSTORE == 'true'"
run: docker-compose --env-file ci/release.env run assemble
working-directory: reproducible-builds
env:
CI_KEYSTORE_PATH: certs/release.jks
CI_KEYSTORE_ALIAS: release
CI_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
- name: Clean up
if: "always()"
run: rm -f certs/release.jks
working-directory: reproducible-builds
- name: Log checksums
run: find outputs \( -name "*.aab" -o -name "*.apk" \) -exec sha256sum '{}' +
working-directory: reproducible-builds
- name: Upload APKs
uses: actions/upload-artifact@v3
with:
name: apk
path: reproducible-builds/outputs/apk/*/release/*.apk
if-no-files-found: error
- name: Upload Bundles
uses: actions/upload-artifact@v3
with:
name: bundle
path: reproducible-builds/outputs/bundle/*Release/*.aab
if-no-files-found: error
publish:
name: Publish
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Check version for upgrade compatibility
run: |
gh release list --exclude-drafts
gh release download --pattern '*.apk' --dir latest || exit 0
latest_apks=(latest/*.apk)
build_apks=(apk/*/release/*.apk)
version_code() {
local aapt=($ANDROID_HOME/build-tools/30.*/aapt)
$aapt d badging "$1" | gawk 'match($0, /^package:.*versionCode=.([0-9]+)/, v) {print v[1]}'
}
test $(version_code "$build_apks") -gt $(version_code "$latest_apks")
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release draft
run: gh release create -d -t "$GITHUB_REF_NAME" "$GITHUB_REF_NAME" ./apk/*/release/*.apk
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_PAT || secrets.GITHUB_TOKEN }}