forked from darkclad/uxspace
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (99 loc) · 3.99 KB
/
Copy pathrelease.yml
File metadata and controls
116 lines (99 loc) · 3.99 KB
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
# Builds a release on a tag and attaches everything someone needs to trust it:
# the signed APK, both bills of materials, and the mapping file that turns a
# stack trace back into line numbers.
#
# Signing happens only when the repository holds the credentials. A fork without
# them still gets a working run and an unsigned APK, clearly labelled, rather
# than a red cross and a secrets error.
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# The CycloneDX plugin reads the git remote for the BOM's VCS
# reference, and a shallow clone leaves it without one.
fetch-depth: 0
- uses: gradle/actions/wrapper-validation@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- uses: android-actions/setup-android@v3
- name: Install the Rust Android target
run: rustup target add aarch64-linux-android
- uses: gradle/actions/setup-gradle@v4
- name: Restore the signing key
id: signing
if: env.KEYSTORE_BASE64 != ''
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
mkdir -p "$RUNNER_TEMP/keys"
echo "$KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/keys/release.jks"
cat > "$RUNNER_TEMP/keys/keystore.properties" <<EOF
storeFile=$RUNNER_TEMP/keys/release.jks
storePassword=$KEYSTORE_PASSWORD
keyAlias=$KEY_ALIAS
keyPassword=$KEY_PASSWORD
EOF
echo "UXSPACE_KEYSTORE_PROPERTIES=$RUNNER_TEMP/keys/keystore.properties" >> "$GITHUB_ENV"
echo "signed=true" >> "$GITHUB_OUTPUT"
- name: Assemble
working-directory: Android
run: ./gradlew assembleRelease
- name: Test
working-directory: Android
run: ./gradlew test
- name: Bill of materials
working-directory: Android
run: |
./gradlew :app:cyclonedxBom
curl -fsSL -o /tmp/cyclonedx \
https://github.com/CycloneDX/cyclonedx-cli/releases/latest/download/cyclonedx-linux-x64
chmod +x /tmp/cyclonedx
sudo mv /tmp/cyclonedx /usr/local/bin/cyclonedx
python3 tools/make_sbom.py
cyclonedx validate \
--input-file build/sbom/uxspace-bom.json \
--input-format json --input-version v1_6 --fail-on-errors
- name: Verify the APK carries the open driver
working-directory: Android
run: |
unzip -l app/build/outputs/apk/release/*.apk | grep -q libviture_v2.so
! unzip -l app/build/outputs/apk/release/*.apk | grep -qi 'vituresdk\|libviture\.so'
- name: Publish
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
files: |
Android/app/build/outputs/apk/release/*.apk
Android/build/sbom/uxspace-bom.json
Android/build/sbom/uxspace-bom.spdx.json
Android/app/build/outputs/mapping/release/mapping.txt
THIRD-PARTY-NOTICES.md
body: |
${{ steps.signing.outputs.signed == 'true'
&& 'Signed release APK.'
|| '**Unsigned** — built without signing credentials.' }}
Attached: the APK, a CycloneDX 1.6 and an SPDX-2.3 bill of materials
covering both the Gradle graph and the Rust driver, the R8 mapping
file, and the third-party notices.
Verify:
```sh
apksigner verify --print-certs app-release.apk
cyclonedx validate --input-file uxspace-bom.json \
--input-format json --input-version v1_6 --fail-on-errors
```