diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml new file mode 100644 index 0000000..8821b9a --- /dev/null +++ b/.github/workflows/android-release.yml @@ -0,0 +1,70 @@ +name: Android Release Build + +on: + push: + tags: + - 'v*' + +jobs: + build: + name: Build and Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew assembleRelease + + - name: Sign APK + uses: r0adkll/sign-android-release@v1 + id: sign_app + with: + releaseDirectory: app/build/outputs/apk/release + signingKeyBase64: ${{ secrets.SIGNING_KEY }} + alias: ${{ secrets.KEY_ALIAS }} + keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} + keyPassword: ${{ secrets.KEY_PASSWORD }} + env: + BUILD_TOOLS_VERSION: "33.0.0" + + - name: Get the version + id: get_version + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Rename APK with version + run: | + cp ${{ steps.sign_app.outputs.signedReleaseFile }} SimpleLogUpload-${{ steps.get_version.outputs.VERSION }}.apk + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.ref }} + name: SimpleLogUpload ${{ steps.get_version.outputs.VERSION }} + draft: false + prerelease: false + files: | + SimpleLogUpload-${{ steps.get_version.outputs.VERSION }}.apk + app/build/outputs/apk/release/app-release-unsigned.apk + body: | + # SimpleLogUpload ${{ steps.get_version.outputs.VERSION }} + + Android client written in Java to easily upload files, including Samsung dumpstate files. + + ## Installation + Download and install the APK file on your Android device. + + ## Requirements + - Android 14+ + - SimpleFileUpload-Server for handling the uploaded files diff --git a/README.md b/README.md index e60584b..51d87f6 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,32 @@ Note - this requires that you leverage SimpleFileUpload-Server - Upload history filtering and search - QR code generation for quick sharing +## Development and Releases + +### Automated Releases with GitHub Actions +This project uses GitHub Actions to automate the build and release process: + +1. **Creating a new release:** + - Make your changes and commit them to the repository + - Create and push a new tag following the format `vYY.MM.PATCH` (e.g., `v25.04.1`) + - GitHub Actions will automatically: + - Build the APK + - Sign it using the stored signing keys + - Create a GitHub release with the APK attached + +2. **Signing Configuration:** + Before the automated releases will work, you need to add the following secrets to your GitHub repository: + - `SIGNING_KEY`: Base64-encoded keystore file + - `KEY_ALIAS`: The alias used in the keystore + - `KEY_STORE_PASSWORD`: The keystore password + - `KEY_PASSWORD`: The key password + +3. **Release Versioning:** + We follow a `vYY.MM.PATCH` versioning scheme: + - `YY`: Year (e.g., 25 for 2025) + - `MM`: Month (e.g., 04 for April) + - `PATCH`: Incremental patch number for the month + ## Feature Details ### Custom Upload Parameters diff --git a/RELEASE_PROCESS.md b/RELEASE_PROCESS.md new file mode 100644 index 0000000..3c44e21 --- /dev/null +++ b/RELEASE_PROCESS.md @@ -0,0 +1,96 @@ +# Release Process for SimpleLogUpload + +This document describes the process of creating new releases for the SimpleLogUpload Android application using GitHub Actions. + +## Versioning Scheme + +We use a `vYY.MM.PATCH` versioning format: +- `YY`: Year (last two digits, e.g., 25 for 2025) +- `MM`: Month (two digits, e.g., 04 for April) +- `PATCH`: Incremental patch number within the month (starting at 1) + +Example: `v25.04.1` represents the first release in April 2025. + +## Prerequisites + +Before you can use the automated release process, you need to set up the signing configuration: + +1. **Create a keystore** (if you don't already have one): + ```bash + keytool -genkey -v -keystore simplelogupload.keystore -alias upload_key -keyalg RSA -keysize 2048 -validity 10000 + ``` + +2. **Encode your keystore file**: + ```bash + # Make the script executable + chmod +x scripts/prepare_signing_key.sh + + # Run the script with your keystore file + ./scripts/prepare_signing_key.sh /path/to/your/simplelogupload.keystore + ``` + +3. **Add the required secrets to your GitHub repository**: + - `SIGNING_KEY`: The Base64-encoded keystore file (output from step 2) + - `KEY_ALIAS`: The alias of your key (e.g., `upload_key`) + - `KEY_STORE_PASSWORD`: The password for your keystore + - `KEY_PASSWORD`: The password for your key + + Add these at: https://github.com/YOUR-USERNAME/SimpleLogUpload/settings/secrets/actions + +## Creating a New Release + +1. **Update your code**: + - Make all necessary code changes + - Update version numbers in app/build.gradle if needed + - Commit and push your changes to the main branch + +2. **Create and push a tag**: + ```bash + # Get the latest changes + git pull origin main + + # Create a new tag + git tag v25.04.1 + + # Push the tag to GitHub + git push origin v25.04.1 + ``` + +3. **Monitor the GitHub Actions workflow**: + - Go to the "Actions" tab in your repository + - You should see a workflow named "Android Release Build" running + - When complete, it will create a new release with the APK attached + +4. **Verify the release**: + - Check the "Releases" section of your repository + - Ensure the APK file is attached + - Download and test the APK on a device + +## Troubleshooting + +If the automatic release process fails: + +1. **Check the GitHub Actions logs**: + - Go to the "Actions" tab and click on the failed workflow + - Examine the logs for errors + +2. **Common issues**: + - Missing GitHub secrets + - Incorrect keystore information + - Build errors in the codebase + +3. **Manual release**: + If needed, you can build and release manually: + ```bash + # Build the release APK + ./gradlew assembleRelease + + # Sign the APK using your keystore + # (Use apksigner from the Android SDK) + ``` + +## Post-Release Steps + +1. **Announce the release** to users or stakeholders +2. **Monitor for issues** after the release +3. **Plan the next release** and begin work on new features diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..d8bccf9 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,30 @@ +# Development Scripts + +This directory contains helpful scripts for development and release management. + +## prepare_signing_key.sh + +This script helps you prepare your Android signing keystore for use with GitHub Actions by encoding it to Base64 format. + +### Usage + +```bash +# Make the script executable +chmod +x prepare_signing_key.sh + +# Run the script with your keystore file path +./prepare_signing_key.sh /path/to/your/keystore.jks +``` + +The script will output the Base64-encoded keystore which you should add as a GitHub secret named `SIGNING_KEY`. + +### Required GitHub Secrets + +To enable automatic signing and releasing of APKs, add the following secrets to your GitHub repository: + +1. `SIGNING_KEY`: The Base64-encoded keystore file (output from this script) +2. `KEY_ALIAS`: The alias used in your keystore +3. `KEY_STORE_PASSWORD`: The password for your keystore +4. `KEY_PASSWORD`: The password for your key + +Add these secrets at: https://github.com/YOUR-USERNAME/SimpleLogUpload/settings/secrets/actions diff --git a/scripts/prepare_signing_key.sh b/scripts/prepare_signing_key.sh new file mode 100755 index 0000000..229ca1c --- /dev/null +++ b/scripts/prepare_signing_key.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# This script helps encode your Android signing keystore for GitHub Actions secrets + +# Check if a keystore file path is provided +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +KEYSTORE_PATH="$1" + +# Check if the keystore file exists +if [ ! -f "$KEYSTORE_PATH" ]; then + echo "Error: Keystore file not found at $KEYSTORE_PATH" + exit 1 +fi + +# Encode the keystore file to base64 +BASE64_KEYSTORE=$(base64 -i "$KEYSTORE_PATH") + +# Print the encoded value +echo "" +echo "Add the following value to your GitHub repository secrets as SIGNING_KEY:" +echo "" +echo "$BASE64_KEYSTORE" +echo "" +echo "You will also need to add these secrets:" +echo "- KEY_ALIAS: Your keystore alias" +echo "- KEY_STORE_PASSWORD: Your keystore password" +echo "- KEY_PASSWORD: Your key password" +echo "" +echo "These values can be added at: https://github.com/YOUR-USERNAME/SimpleLogUpload/settings/secrets/actions"