feat:building-with-version-number
This commit is contained in:
1 parent
64b9d704fb
commit
7ed3adf208
2 files changed
+68
-2
No files matched your search
@@ -22,6 +22,38 @@ jobs:
|
||||
- uses: android-actions/setup-android@v3
|
||||
# Gitea's act resolver cannot peel the annotated v4 tag alias.
|
||||
- uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4.4.3
|
||||
- name: Set release version
|
||||
if: gitea.event_name == 'release'
|
||||
shell: bash
|
||||
working-directory: android
|
||||
env:
|
||||
TRANSUI_RELEASE_TAG: ${{ gitea.event.release.tag_name }}
|
||||
run: |
|
||||
version="${TRANSUI_RELEASE_TAG#v}"
|
||||
if [[ ! "$version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
||||
echo "Release tag must use vMAJOR.MINOR.PATCH or MAJOR.MINOR.PATCH" >&2
|
||||
exit 1
|
||||
fi
|
||||
major=$((10#${BASH_REMATCH[1]}))
|
||||
minor=$((10#${BASH_REMATCH[2]}))
|
||||
patch=$((10#${BASH_REMATCH[3]}))
|
||||
if (( minor > 999 || patch > 999 )); then
|
||||
echo "Minor and patch versions must be below 1000" >&2
|
||||
exit 1
|
||||
fi
|
||||
version_code=$((major * 1000000 + minor * 1000 + patch))
|
||||
if (( version_code < 1 || version_code > 2100000000 )); then
|
||||
echo "Release version is outside Android's versionCode range" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "TRANSUI_VERSION=$version" >> "$GITEA_ENV"
|
||||
echo "TRANSUI_VERSION_CODE=$version_code" >> "$GITEA_ENV"
|
||||
sed -i -E \
|
||||
-e "s/^([[:space:]]*)versionCode .*/\1versionCode $version_code/" \
|
||||
-e "s/^([[:space:]]*)versionName .*/\1versionName '$version'/" \
|
||||
app/build.gradle
|
||||
grep -Fq " versionCode $version_code" app/build.gradle
|
||||
grep -Fq " versionName '$version'" app/build.gradle
|
||||
- name: Install Android SDK packages
|
||||
run: sdkmanager "platforms;android-35" "build-tools;35.0.0"
|
||||
- name: Lint and test
|
||||
|
||||
Reference in new issue
Block a user