From f2ba761cc14bd47b90d49c9e92bd83a8d0559f69 Mon Sep 17 00:00:00 2001 From: lamtruong28 Date: Wed, 19 Aug 2026 20:28:56 +0700 Subject: [PATCH] Add all files --- .gitea/workflows/android-build.yaml | 85 +++++++++++++++++++++++++++++ .gitea/workflows/sync-source.yaml | 32 +++++++++++ 2 files changed, 117 insertions(+) create mode 100644 .gitea/workflows/android-build.yaml create mode 100644 .gitea/workflows/sync-source.yaml diff --git a/.gitea/workflows/android-build.yaml b/.gitea/workflows/android-build.yaml new file mode 100644 index 0000000..a3d3ebd --- /dev/null +++ b/.gitea/workflows/android-build.yaml @@ -0,0 +1,85 @@ +name: Build APK file +run-name: ${{ gitea.actor }} is building APK file +on: + push: + +jobs: + verify: + name: "Verify environment" + runs-on: android + + steps: + - name: Debug Environment + run: | + whoami + cat /etc/os-release + pwd + which java || true + env | sort + - name: Check Java + run: | + java -version + echo "JAVA_HOME=$JAVA_HOME" + + - name: Check Android SDK + run: | + echo "ANDROID_HOME=$ANDROID_HOME" + echo "PATH=$PATH" + + which sdkmanager || true + + sdkmanager --version || true + + ls -la $ANDROID_HOME || true + + build-android: + name: "Build APK file" + runs-on: android + needs: verify + steps: + - uses: actions/checkout@v4 + + - name: Grant execute permission + run: chmod +x ./gradlew + + # - name: List Gradle Projects + # run: ./gradlew projects + + - name: Build Android APK + run: ./gradlew :androidApp:assembleDebug --stacktrace + + - name: Find location APK file + run: | + find . -name "*.apk" + + - name: Show APK + run: | + ls -lah androidApp/build/outputs/apk/debug/ + + # - uses: actions/upload-artifact@v4 + # with: + # name: TorqueVault-apk + # path: androidApp/build/outputs/apk/debug/androidApp-debug.apk + + - name: Build Package Version + shell: bash + run: | + VERSION_NAME=$(grep -R "versionName" androidApp/build.gradle.kts \ + | head -1 \ + | sed 's/.*"\(.*\)".*/\1/') + + SHORT_SHA=$(git rev-parse --short HEAD) + + PACKAGE_VERSION="${VERSION_NAME}+${SHORT_SHA}" + + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV + + echo "Package Version: $PACKAGE_VERSION" + + - name: Upload APK to Package Registry + run: | + curl \ + --fail \ + --user "${{ github.actor }}:${{ secrets.PACKAGE_TOKEN }}" \ + --upload-file androidApp/build/outputs/apk/debug/androidApp-debug.apk \ + "${{ github.server_url }}/api/packages/${{ github.repository_owner }}/generic/torque-vault/${PACKAGE_VERSION}/Torque-Vault.apk" \ No newline at end of file diff --git a/.gitea/workflows/sync-source.yaml b/.gitea/workflows/sync-source.yaml new file mode 100644 index 0000000..8bda48e --- /dev/null +++ b/.gitea/workflows/sync-source.yaml @@ -0,0 +1,32 @@ +name: Sync Source to Host +run-name: ${{ gitea.actor }} is synchronizing the source code to the host + +on: + push: + branches: + - main + - develop +jobs: + sync-source: + runs-on: ubuntu-latest + + steps: + - name: Sync repository + run: | + REPO_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" + REPO_NAME=$(basename "${GITHUB_REPOSITORY}") + TARGET_DIR="/data/${REPO_NAME}" + BRANCH="${GITHUB_REF_NAME}" + + if [ ! -d "$TARGET_DIR/.git" ]; then + echo "Cloning repository..." + git clone -b "$BRANCH" "$REPO_URL" "$TARGET_DIR" + else + echo "Updating repository..." + git -C "$TARGET_DIR" fetch origin "$BRANCH" + git -C "$TARGET_DIR" checkout "$BRANCH" + git -C "$TARGET_DIR" reset --hard "origin/$BRANCH" + fi + + echo "Current commit:" + git -C "$TARGET_DIR" log --oneline -1 \ No newline at end of file