name: Build APK on: push: branches: [main] jobs: build-apk: if: contains(github.event.head_commit.message, '[apk]') runs-on: docker steps: - name: Notify Start uses: https://git.data-it-solution.de/data/ntfy-action@main with: status: start project: NetDiag APK ntfy_auth: ${{ secrets.NTFY_AUTH }} run_number: ${{ github.run_number }} message: ${{ github.event.head_commit.message }} - name: Repo klonen + Version festlegen run: | git clone https://data:${{ secrets.GIT_TOKEN }}@git.data-it-solution.de/data/netdiag-app.git . git checkout ${{ github.sha }} echo "$(date +%Y%m%d-%H%M)" > /tmp/BUILD_VERSION - name: Node.js Dependencies installieren run: npm install - name: Frontend bauen run: VITE_APP_VERSION="$(cat /tmp/BUILD_VERSION)" npx vite build # android/ liegt komplett im Repo (Kotlin, Plugin, MainActivity, Manifest, # Signing-Config sind dort fest eingerichtet). cap sync kopiert nur die # Web-Assets rein und aktualisiert die Plugin-Liste. - name: Capacitor sync run: npx cap sync android - name: Keystore + Signing-Properties vorbereiten run: | echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > /tmp/release.jks cat >> android/gradle.properties < local.properties chmod +x gradlew ./gradlew assembleRelease --no-daemon - name: APK in Package Registry hochladen run: | VERSION=$(cat /tmp/BUILD_VERSION) APK_FILE=$(find android/app/build -name "*.apk" -path "*/release/*" | head -1) echo "APK gefunden: $APK_FILE" curl --fail --user "data:${{ secrets.REGISTRY_TOKEN }}" \ --upload-file "$APK_FILE" \ "https://git.data-it-solution.de/api/packages/data-it/generic/netdiag-apk/${VERSION}/NetDiag-${VERSION}.apk" curl -s -X DELETE --user "data:${{ secrets.REGISTRY_TOKEN }}" \ "https://git.data-it-solution.de/api/v1/packages/data-it/generic/netdiag-apk/latest" || true curl --fail --user "data:${{ secrets.REGISTRY_TOKEN }}" \ --upload-file "$APK_FILE" \ "https://git.data-it-solution.de/api/packages/data-it/generic/netdiag-apk/latest/NetDiag.apk" echo "APK hochgeladen: ${VERSION} + latest" - name: Notify Success if: success() uses: https://git.data-it-solution.de/data/ntfy-action@main with: status: success project: NetDiag APK ntfy_auth: ${{ secrets.NTFY_AUTH }} run_number: ${{ github.run_number }} - name: Notify Failure if: failure() uses: https://git.data-it-solution.de/data/ntfy-action@main with: status: failure project: NetDiag APK ntfy_auth: ${{ secrets.NTFY_AUTH }} run_number: ${{ github.run_number }} click_url: https://git.data-it-solution.de/${{ github.repository }}/actions