Android Release #30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Android Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_run: | |
| workflows: ["Auto-release Tag"] | |
| types: [completed] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| if: > | |
| github.event_name == 'push' || | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Resolve version from latest tag | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| # Tag push — version comes from the tag ref | |
| echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| else | |
| # workflow_run or workflow_dispatch — find latest v* tag | |
| TAG=$(git describe --tags --abbrev=0 --match 'v*' 2>/dev/null || echo "") | |
| if [ -z "$TAG" ]; then | |
| echo "::error::No version tag (v*) found in repository" | |
| exit 1 | |
| fi | |
| echo "TAG=$TAG" >> $GITHUB_OUTPUT | |
| echo "VERSION=${TAG#v}" >> $GITHUB_OUTPUT | |
| # Verify gradle.properties matches the tag | |
| MAJOR=$(grep "^VERSION_MAJOR=" accbot-android/gradle.properties | cut -d= -f2) | |
| MINOR=$(grep "^VERSION_MINOR=" accbot-android/gradle.properties | cut -d= -f2) | |
| PATCH=$(grep "^VERSION_PATCH=" accbot-android/gradle.properties | cut -d= -f2) | |
| PROPS_VERSION="${MAJOR}.${MINOR}.${PATCH}" | |
| if [ "$PROPS_VERSION" != "${TAG#v}" ]; then | |
| echo "::warning::gradle.properties version ($PROPS_VERSION) does not match latest tag ($TAG)" | |
| fi | |
| fi | |
| - name: Validate changelog | |
| run: | | |
| VERSION="${{ steps.version.outputs.VERSION }}" | |
| CHANGELOG="changelog.json" | |
| if [ ! -f "$CHANGELOG" ]; then | |
| echo "::error::changelog.json not found" | |
| exit 1 | |
| fi | |
| # Check entry exists for this version | |
| ENTRY=$(jq -r --arg ver "$VERSION" '.[] | select(.version == $ver) | .version' "$CHANGELOG") | |
| if [ -z "$ENTRY" ]; then | |
| echo "::error::No changelog entry found for v$VERSION" | |
| exit 1 | |
| fi | |
| # Check for TODO placeholders | |
| HAS_TODO=$(jq -r --arg ver "$VERSION" \ | |
| '.[] | select(.version == $ver) | | |
| (.title | to_entries[].value) + " " + | |
| ([.features | to_entries[].value[]] | join(" "))' \ | |
| "$CHANGELOG" | grep -c "TODO" || true) | |
| if [ "$HAS_TODO" -gt 0 ]; then | |
| echo "::error::changelog.json for v$VERSION still contains TODO placeholders" | |
| exit 1 | |
| fi | |
| echo "Changelog validated for v$VERSION" | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x accbot-android/gradlew | |
| - name: Decode keystore | |
| run: | | |
| echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > accbot-android/accbot-upload.jks | |
| - name: Build Debug APK | |
| run: | | |
| cd accbot-android | |
| ./gradlew assembleDebug | |
| - name: Build signed Release APK | |
| env: | |
| KEYSTORE_PATH: ${{ github.workspace }}/accbot-android/accbot-upload.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| run: | | |
| cd accbot-android | |
| ./gradlew assembleRelease | |
| - name: Build signed AAB (for Play Store) | |
| env: | |
| KEYSTORE_PATH: ${{ github.workspace }}/accbot-android/accbot-upload.jks | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| run: | | |
| cd accbot-android | |
| ./gradlew bundleRelease | |
| - name: Rename artifacts with version | |
| run: | | |
| cd accbot-android/app/build/outputs | |
| if [ -f apk/debug/app-debug.apk ]; then | |
| mv apk/debug/app-debug.apk apk/debug/accbot-${{ steps.version.outputs.VERSION }}-debug.apk | |
| fi | |
| if [ -f apk/release/app-release.apk ]; then | |
| mv apk/release/app-release.apk apk/release/accbot-${{ steps.version.outputs.VERSION }}-release.apk | |
| fi | |
| if [ -f bundle/release/app-release.aab ]; then | |
| mv bundle/release/app-release.aab bundle/release/accbot-${{ steps.version.outputs.VERSION }}-release.aab | |
| fi | |
| - name: Clean up keystore | |
| if: always() | |
| run: rm -f accbot-android/accbot-upload.jks | |
| - name: Extract release notes from changelog.json | |
| id: notes | |
| run: | | |
| VERSION="${{ steps.version.outputs.VERSION }}" | |
| CHANGELOG="changelog.json" | |
| if [ -f "$CHANGELOG" ] && command -v jq &>/dev/null; then | |
| BODY=$(jq -r --arg ver "$VERSION" ' | |
| .[] | select(.version == $ver) | | |
| "**\(.title.en)**\n" + | |
| ([.features.en[] | "- \(.)"] | join("\n")) | |
| ' "$CHANGELOG") | |
| fi | |
| if [ -z "$BODY" ]; then | |
| BODY="See the [commit history](https://github.com/${{ github.repository }}/commits/v${VERSION}) for changes." | |
| fi | |
| # Write multiline output | |
| { | |
| echo "BODY<<EOF" | |
| echo "$BODY" | |
| echo "EOF" | |
| } >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.VERSION }} | |
| name: AccBot Android v${{ steps.version.outputs.VERSION }} | |
| body: | | |
| ## AccBot Android v${{ steps.version.outputs.VERSION }} | |
| Self-custody crypto DCA app for Android. | |
| ### Downloads | |
| - **APK** — install directly on your device (enable "Install from unknown sources") | |
| - **AAB** — upload to Google Play Console | |
| ### What's New | |
| ${{ steps.notes.outputs.BODY }} | |
| files: | | |
| accbot-android/app/build/outputs/apk/debug/accbot-${{ steps.version.outputs.VERSION }}-debug.apk | |
| accbot-android/app/build/outputs/apk/release/accbot-${{ steps.version.outputs.VERSION }}-release.apk | |
| accbot-android/app/build/outputs/bundle/release/accbot-${{ steps.version.outputs.VERSION }}-release.aab | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |