diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..0cfbfda2d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,51 @@ +name: Test/Build Android + +on: + pull_request: + branches: [main] + push: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Cache gradle + uses: actions/cache@v1 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Test (gradle) + run: ./gradlew test --no-daemon + + - name: Android Test Report + uses: asadmansr/android-test-report-action@v1.2.0 + if: ${{ always() }} # IMPORTANT: run Android Test Report regardless + + - name: Build APK (gradle) + run: ./gradlew assembleDebug --no-daemon + + - name: Upload APK + uses: actions/upload-artifact@v2 + with: + name: Debug APK + path: app/build/outputs/apk/debug/app-debug.apk + + - name: Upload Test Results + uses: actions/upload-artifact@v2 + with: + name: Build Reports + path: app/build/reports + diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 000000000..3de6c3996 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,97 @@ +name: Create Release Assets + +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Cache gradle + uses: actions/cache@v1 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Build AAB + run: ./gradlew clean bundleRelease --stacktrace + + - name: Sign AAB + uses: r0adkll/sign-android-release@v1 + with: + releaseDirectory: app/build/outputs/bundle/release + signingKeyBase64: ${{ secrets.SIGNING_KEY }} + alias: ${{ secrets.KEY_ALIAS }} + keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} + keyPassword: ${{ secrets.KEY_PASSWORD }} + + - name: Build APK + run: ./gradlew assembleRelease --stacktrace --no-daemon + + - name: Sign APK + uses: r0adkll/sign-android-release@v1 + with: + releaseDirectory: app/build/outputs/apk/release + signingKeyBase64: ${{ secrets.SIGNING_KEY }} + alias: ${{ secrets.KEY_ALIAS }} + keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} + keyPassword: ${{ secrets.KEY_PASSWORD }} + + - name: Build WAR + run: ./gradlew stage --stacktrace --no-daemon + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload APK Asset + id: upload-release-asset-apk + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: app/build/outputs/apk/release/app-release-unsigned-signed.apk + asset_name: app-release-${{ github.ref_name }}.apk + asset_content_type: application/zip + + - name: Upload AAB Asset + id: upload-release-asset-aab + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: app/build/outputs/bundle/release/app-release.aab + asset_name: app-release-${{ github.ref_name }}.aab + asset_content_type: application/zip + + - name: Upload WAR Asset + id: upload-release-asset-war + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: web/build/libs/web.war + asset_name: web-release-${{ github.ref_name }}.war + asset_content_type: application/zip diff --git a/README.md b/README.md index 26ff59f0b..03a57cae4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,98 @@ -# amethyst -Nostr client for Android +# Amethyst: Nostr client for Android + + + +Amethyst brings the best social network to your Android phone. Just insert your Nostr private key and start posting. + +# Current Features + +[x] Account Management +[x] Home Feed +[x] Notifications Feed +[x] Global Feed +[x] Reactions (like, boost, reply) +[x] Image Preview +[x] Url Preview +[ ] View Threads +[ ] Private Messages +[ ] Communities +[ ] Profile Edit +[ ] Relay Edit + +# Development Overview + +## Setup + +Make sure to have the following pre-requisites installed: +1. Java 11 +2. Android Studio +3. Android 8.0+ Phone or Emulation setup + +Fork and clone this repository and import into Android Studio +```bash +git clone https://github.com/vitorpamplona/amethyst.git +``` + +Use one of the Android Studio builds to install and run the app in your device or a simulator. + +## Building +Build the app: +```bash +./gradlew assembleDebug +``` + +## Testing +```bash +./gradlew test +./gradlew connectedAndroidTest +``` + +## Installing on device +```bash +./gradlew installDebug +``` + +## How to Deploy + +1. Generate a new signing key +``` +keytool -genkey -v -keystore -alias -keyalg RSA -keysize 2048 -validity 10000 +openssl base64 < | tr -d '\n' | tee some_signing_key.jks.base64.txt +``` +2. Create 4 Secret Key variables on your GitHub repository and fill in with the signing key information + - `KEY_ALIAS` <- `` + - `KEY_PASSWORD` <- `` + - `KEY_STORE_PASSWORD` <- `` + - `SIGNING_KEY` <- the data from `` +3. Change the `versionCode` and `versionName` on `app/build.gradle` +4. Commit and push. +5. Tag the commit with `v{x.x.x}` +6. Let the [Create Release GitHub Action](https://github.com/vitorpamplona/amethyst/actions/workflows/create-release.yml) build a new `aab` file. +7. Add your CHANGE LOG to the description of the new release +8. Download the `aab` file and upload it to the` PlayStore. + +# Contributing + +[Issues](https://github.com/vitorpamplona/amethyst/issues) and [pull requests](https://github.com/vitorpamplona/amethyst/pulls) are very welcome. + +# MIT License + +Copyright (c) 2023 Vitor Pamplona + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file