Colota - Android GPS Location tracker
added workflows for builds
Max Dietrich61db0d3e974b
diff --git a/.github/workflows/latest-release.yml b/.github/workflows/latest-release.ymlnew file mode 100644index 00000000..16c6f93d--- /dev/null+++ b/.github/workflows/latest-release.yml@@ -0,0 +1,98 @@+name: Latest Release++on:+ push:+ branches: [ main ]+ workflow_dispatch:++concurrency:+ group: latest-release+ cancel-in-progress: true++jobs:+ # JOB 1: Verification+ test:+ name: Lint & Test+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4+ - uses: actions/setup-node@v4+ with:+ node-version: '20'+ cache: 'npm'++ - run: npm ci+ - name: Run Lint+ run: npm run lint+ - name: Run Type Check+ run: npx tsc --noEmit+ - name: Run Tests+ run: npm test++ # JOB 2: Build & Release (Only runs if 'test' passes)+ build-and-release:+ name: Build & Update Latest+ needs: test # <--- THIS IS THE MAGIC LINE+ runs-on: ubuntu-latest+ permissions:+ contents: write++ steps:+ - name: Checkout code+ uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Setup Node & Java+ uses: actions/setup-node@v4+ with:+ node-version: '20'+ cache: 'npm'+ - uses: actions/setup-java@v4+ with:+ distribution: 'temurin'+ java-version: '17'+ cache: 'gradle'++ - name: Install dependencies+ run: npm ci++ - name: Decode keystore+ env:+ KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}+ run: echo $KEYSTORE_BASE64 | base64 -d > android/app/release.keystore++ - name: Build Release APK+ env:+ KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}+ KEY_ALIAS: ${{ secrets.KEY_ALIAS }}+ KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}+ run: |+ cd android+ ./gradlew assembleRelease --no-daemon++ - name: Update Latest Tag+ run: |+ git config --global user.name "github-actions[bot]"+ git config --global user.email "github-actions[bot]@users.noreply.github.com"+ git tag -f latest+ git push -f origin latest++ - name: Publish to GitHub Release+ uses: softprops/action-gh-release@v2+ with:+ tag_name: latest+ name: "Latest Development Build"+ body: |+ ## 🚀 Automated Build (Tests Passed ✅)+ Built from commit: `${{ github.sha }}`+ draft: false+ prerelease: true+ files: |+ android/app/build/outputs/apk/release/app-release.apk+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}++ - name: Secure Cleanup+ if: always()+ run: shred -u android/app/release.keystore\ No newline at end of filediff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.ymlindex a71e3200..9863f46d 100644--- a/.github/workflows/lint-test.yml+++ b/.github/workflows/lint-test.yml@@ -3,8 +3,12 @@ name: Lint & Teston:push:branches: [ main, develop ]+ paths-ignore:+ - '**.md'pull_request:branches: [ main, develop ]+ paths-ignore:+ - '**.md'workflow_dispatch:jobs:diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 8f5ce732..364e10d8 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -6,9 +6,39 @@ on:- 'v*.*.*'jobs:+ # 1. Validation Job: Must pass before building artifacts+ validate:+ name: Lint & Test+ runs-on: ubuntu-latest+ steps:+ - name: Checkout code+ uses: actions/checkout@v4++ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: '20'+ cache: 'npm'++ - name: Install dependencies+ run: npm ci++ - name: Run ESLint+ run: npm run lint++ - name: Run TypeScript check+ run: npx tsc --noEmit++ - name: Run tests+ run: npm test++ # 2. Build Job: Only runs if 'validate' is successfulbuild-release:name: Build Release APK & AAB+ needs: validate # <--- Critical: Prevents broken releasesruns-on: ubuntu-latest+ permissions:+ contents: write # Required to create the releasesteps:- name: Checkout code@@ -34,37 +64,30 @@ jobs:env:KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}run: |+ # Decodes your secret and places it where Gradle expects itecho $KEYSTORE_BASE64 | base64 -d > android/app/release.keystore- - name: Build release APK- env:- KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}- KEY_ALIAS: ${{ secrets.KEY_ALIAS }}- KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}- run: |- cd android- ./gradlew assembleRelease --no-daemon-- - name: Build release AAB+ - name: Build Android Assets (APK & AAB)env:KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}KEY_ALIAS: ${{ secrets.KEY_ALIAS }}KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}run: |cd android- ./gradlew bundleRelease --no-daemon+ # Build both formats in one go to optimize Gradle tasks+ ./gradlew assembleRelease bundleRelease --no-daemon- name: Get version from tagid: versionrun: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT- - name: Rename APK+ - name: Rename APK for Clarityrun: |mv android/app/build/outputs/apk/release/app-release.apk \android/app/build/outputs/apk/release/colota-${{ steps.version.outputs.VERSION }}.apk- name: Create GitHub Release- uses: softprops/action-gh-release@v1+ uses: softprops/action-gh-release@v2with:files: |android/app/build/outputs/apk/release/colota-${{ steps.version.outputs.VERSION }}.apk@@ -75,6 +98,6 @@ jobs:env:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- - name: Clean up keystore+ - name: Securely Clean up keystoreif: always()- run: rm -f android/app/release.keystore\ No newline at end of file+ run: shred -u android/app/release.keystore\ No newline at end of file