build with version file

This commit is contained in:
sora committed 2026-11-14 13:39:31 +01:00
1 parent a5c825c8e0
commit d8fd4aaded
1 file changed
+15 -10
+15 -10
View File
@@ -10,7 +10,7 @@ on:
push: push:
branches: [main] branches: [main]
tags: tags:
- '**' - "**"
pull_request: pull_request:
branches: [main] branches: [main]
workflow_dispatch: workflow_dispatch:
@@ -67,9 +67,8 @@ jobs:
else else
VERSION_NAME="${VERSION_BASE}" VERSION_NAME="${VERSION_BASE}"
fi fi
printf '%s\n%s\n' "$VERSION_CODE" "$VERSION_NAME" > version.txt
./gradlew bundleSignedRelease assembleSignedRelease -PVERSION_CODE=$VERSION_CODE -PVERSION_NAME=$VERSION_NAME ./gradlew bundleSignedRelease assembleSignedRelease -PVERSION_CODE=$VERSION_CODE -PVERSION_NAME=$VERSION_NAME
# ./gradlew assembleSignedRelease -PVERSION_CODE=$VERSION_CODE -PVERSION_NAME=$VERSION_NAME
# ./gradlew bundleSignedRelease -PVERSION_CODE=$VERSION_CODE -PVERSION_NAME=$VERSION_NAME
- name: Upload APK - name: Upload APK
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7
@@ -78,22 +77,28 @@ jobs:
compression-level: 0 compression-level: 0
archive: false archive: false
- name: Determine prerelease
id: prerelease
if: startsWith(github.ref, 'refs/tags/')
run: |
if [[ "$GITHUB_REF_NAME" =~ ^[0-9]+\.[0-9]+[a-z]+$ ]]; then
echo "value=false" >> "$GITHUB_OUTPUT"
else
echo "value=true" >> "$GITHUB_OUTPUT"
fi
- name: Release - name: Release
uses: softprops/action-gh-release@v3 uses: softprops/action-gh-release@v3
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
files: | files: |
app/build/outputs/apk/signedRelease/app-signedRelease.apk app/build/outputs/apk/signedRelease/app-signedRelease.apk
prerelease: | version.txt
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+[a-z]+$ ]]; then prerelease: ${{ steps.prerelease.outputs.value }}
echo "false"
else
echo "true"
fi
- name: Upload to Google Play - name: Upload to Google Play
uses: r0adkll/upload-google-play@v1 uses: r0adkll/upload-google-play@v1
# if: startsWith(github.ref, 'refs/tags/') if: github.event_name == 'push'
with: with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: net.helcel.cowspent packageName: net.helcel.cowspent