Repository navigation
113 lines (94 loc) · 4.11 KB
/
Copy pathunstable.yml
File metadata and controls
113 lines (94 loc) · 4.11 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
name: Unstable
# Unstable / pre-release channel. These builds DO self-update: the app checks GitHub
# pre-releases and downloads a newer unstable APK (origin allowlist + signature check).
on:
push:
branches: [master]
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build and publish unstable APK
runs-on: ubuntu-latest
env:
SIGNING_KEYSTORE_BASE64: ${{ secrets.SIGNING_KEYSTORE_BASE64 }}
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 1, submodules: recursive }
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Decode signing keystore
if: ${{ env.SIGNING_KEYSTORE_BASE64 != '' }}
run: |
printf '%s' "$SIGNING_KEYSTORE_BASE64" | tr -d '[:space:]' | base64 -d > "$RUNNER_TEMP/signing.keystore"
if [ "$(head -c1 "$RUNNER_TEMP/signing.keystore" | od -An -tx1 | tr -d ' ')" != "30" ]; then
echo "::error::SIGNING_KEYSTORE_BASE64 is invalid. Recreate it with: base64 -w0 signing.keystore"
exit 1
fi
echo "SIGNING_KEYSTORE=$RUNNER_TEMP/signing.keystore" >> "$GITHUB_ENV"
- name: Run checks
run: |
chmod +x gradlew
bash .github/security/check-permissions.sh
./gradlew testUnstableDebugUnitTest lintUnstableDebug --no-daemon
- name: Resolve unstable version
id: version
run: |
chmod +x gradlew
v=$(./gradlew -q printUnstableVersion -PunstableBuild=${{ github.run_number }} --no-daemon | tail -1)
echo "value=$v" >> "$GITHUB_OUTPUT"
- name: Build unstable release APK
env:
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: ./gradlew assembleUnstableRelease -PunstableBuild=${{ github.run_number }} --no-daemon
- name: Collect APK
run: |
mkdir -p dist
# The release tag is the fixed string "unstable", so the version lives in the asset
# name: the updater matches ".apk" + "unstable" and reads the version from it.
find app/build/outputs/apk -name "EVABRPUploader-unstable.apk" \
-exec cp {} "dist/EVABRPUploader-unstable-${{ steps.version.outputs.value }}.apk" \;
ls -la dist/
- name: Build timestamp
id: date
run: echo "value=$(date -u +'%Y-%m-%d %H:%M UTC')" >> "$GITHUB_OUTPUT"
- name: Extract changelog
id: changelog
run: |
{
echo 'notes<<CHANGELOG_EOF'
./release-notes.sh --latest
echo 'CHANGELOG_EOF'
} >> "$GITHUB_OUTPUT"
# One rolling pre-release: drop the previous release and its tag so the new one is
# published at this commit instead of leaving the tag behind on the old sha.
- name: Reset rolling unstable release
env:
GH_TOKEN: ${{ github.token }}
run: gh release delete unstable --cleanup-tag --yes || true
- name: Publish pre-release
uses: softprops/action-gh-release@v2
with:
# Fixed tag, overwritten on every build. The in-app updater no longer reads a
# version from here — it reads it from the APK asset name.
tag_name: unstable
name: Unstable
prerelease: true
files: dist/*.apk
body: |
## Unstable build ${{ steps.date.outputs.value }}
Version `${{ steps.version.outputs.value }}` (run ${{ github.run_number }}).
Automated build from `master`. **Not tested on a vehicle.**
Installed unstable builds update themselves from this channel. The updater accepts
an APK only over https from a GitHub host, and only if it is signed with the
same certificate as the running app — otherwise it deletes the file.
### Changelog
${{ steps.changelog.outputs.notes }}
Commit: ${{ github.sha }}