Translated using Weblate (#46) Translate-URL: https://hosted.weblate.org/projects/droidspaces/plurals/si/ Translate-URL: https://hosted.weblate.org/projects/droidspaces/plurals/zh_Hans/ Translate-URL: https://hosted.weblate.org/projects/droidspaces/strings/ Translate-URL: https://hosted.weblate.org/projects/droidspaces/strings/ro/ Translate-URL: https://hosted.weblate.org/projects/droidspaces/strings/si/ Translate-URL: https://hosted.weblate.org/projects/droidspaces/strings/tr/ Translate-URL: https://ho... #438
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Droidspaces CI | |
| run-name: ${{ github.event.head_commit.message || format('Release {0}', github.event.inputs.tag_name) || github.workflow }} | |
| on: | |
| push: | |
| branches: [ "main", "master" ] | |
| pull_request: | |
| branches: [ "main", "master" ] | |
| workflow_dispatch: | |
| inputs: | |
| create_release: | |
| description: 'Create an Official GitHub Release?' | |
| required: true | |
| type: boolean | |
| default: false | |
| tag_name: | |
| description: 'Tag name (Only used if Release is checked)' | |
| required: false | |
| default: 'test' | |
| jobs: | |
| build: | |
| name: Build Backend & Android App | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Install dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y build-essential wget tree | |
| - name: Download Toolchains | |
| run: | | |
| mkdir -p $HOME/toolchains | |
| cd $HOME/toolchains | |
| BASE_URL="https://github.com/ravindu644/Droidspaces-OSS/releases/download/compilers" | |
| echo "[*] Downloading aarch64 toolchain..." | |
| wget -q $BASE_URL/aarch64-linux-musl-cross.tar.gz | |
| echo "[*] Downloading armhf toolchain..." | |
| wget -q $BASE_URL/arm-linux-musleabihf-cross.tar.gz | |
| echo "[*] Downloading x86 toolchain..." | |
| wget -q $BASE_URL/i686-linux-musl-cross.tar.gz | |
| echo "[*] Downloading x86_64 toolchain..." | |
| wget -q $BASE_URL/x86_64-linux-musl-cross.tar.gz | |
| echo "[*] Extracting toolchains..." | |
| for f in *.tar.gz; do | |
| echo "Extracting $f..." | |
| tar -xzf "$f" | |
| done | |
| echo "[+] Toolchains ready." | |
| tree -L 3 $HOME/toolchains | |
| - name: Build All Tarball & Sync to Android | |
| run: make all-tarball | |
| - name: Decode Keystore | |
| env: | |
| RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }} | |
| if: "${{ env.RELEASE_KEYSTORE != '' }}" | |
| run: echo "${{ env.RELEASE_KEYSTORE }}" | base64 -d > droidspaces.keystore | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x Android/gradlew | |
| - name: Build Android App with Gradle | |
| env: | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| run: | | |
| cd Android | |
| ./gradlew assembleRelease \ | |
| -PKEYSTORE_PASSWORD="${{ secrets.KEYSTORE_PASSWORD }}" \ | |
| -PKEY_ALIAS="${{ secrets.KEY_ALIAS }}" \ | |
| -PKEY_PASSWORD="${{ secrets.KEY_PASSWORD }}" | |
| - name: Stage & Rename Artifacts | |
| run: | | |
| TAG="${{ github.event.inputs.tag_name || 'test' }}" | |
| DATE=$(date +%Y-%m-%d) | |
| APK_NAME="Droidspaces-universal-${TAG}-${DATE}.apk" | |
| TAR_NAME=$(ls droidspaces-v*-*.tar.gz) | |
| mkdir -p dist | |
| mv Android/app/build/outputs/apk/release/app-release.apk dist/${APK_NAME} | |
| mv ${TAR_NAME} dist/ | |
| echo "APK_FILE=dist/${APK_NAME}" >> $GITHUB_ENV | |
| echo "TAR_FILE=dist/${TAR_NAME}" >> $GITHUB_ENV | |
| - name: Generate Telegram Message | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| EVENT_TYPE="${{ github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true' && 'Official Release' || 'Git Push' }}" | |
| COMMIT_MSG=$(git log -1 --pretty=format:%B) | |
| { | |
| echo "TELEGRAM_MESSAGE<<EOF" | |
| echo "**Droidspaces Build Successful**" | |
| echo "" | |
| echo "**Repository:** [${{ github.repository }}](https://github.com/${{ github.repository }})" | |
| echo "**Author:** [${{ github.actor }}](https://github.com/${{ github.actor }})" | |
| echo "**Event:** $EVENT_TYPE" | |
| echo "" | |
| echo "**Commit Message:**" | |
| echo "" | |
| echo "\`\`\`" | |
| echo "$COMMIT_MSG" | |
| echo "\`\`\`" | |
| echo "EOF" | |
| } >> "$GITHUB_ENV" | |
| - name: Send Telegram Notification | |
| if: github.event_name != 'pull_request' | |
| uses: xz-dev/TelegramFileUploader@v1 | |
| with: | |
| to-who: ${{ secrets.TELEGRAM_TO }} | |
| message: ${{ env.TELEGRAM_MESSAGE }} | |
| files: | | |
| ${{ env.APK_FILE }} | |
| ${{ env.TAR_FILE }} | |
| env: | |
| API_ID: ${{ secrets.API_ID }} | |
| API_HASH: ${{ secrets.API_HASH }} | |
| BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
| - name: Upload Final Artifacts (APK & Tarball) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: droidspaces-artifacts | |
| path: dist/ | |
| release: | |
| name: Create GitHub Release | |
| needs: [build] | |
| if: | | |
| github.event_name == 'workflow_dispatch' && | |
| github.event.inputs.create_release == 'true' && | |
| github.event.inputs.tag_name != '' && | |
| github.event.inputs.tag_name != 'test' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-assets | |
| merge-multiple: true | |
| - name: Generate Changelog | |
| id: changelog | |
| run: | | |
| PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| echo "Previous tag: $PREV_TAG" | |
| if [ -z "$PREV_TAG" ]; then | |
| CHANGELOG=$(git log --oneline --pretty=format:"* %s (%h)") | |
| else | |
| CHANGELOG=$(git log ${PREV_TAG}..HEAD --oneline --pretty=format:"* %s (%h)") | |
| fi | |
| { | |
| echo "notes<<EOF" | |
| echo "$CHANGELOG" | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.tag_name }} | |
| name: Droidspaces ${{ github.event.inputs.tag_name || 'Development Build' }} | |
| target_commitish: ${{ github.sha }} | |
| body: | | |
| ## What's Changed | |
| ${{ steps.changelog.outputs.notes }} | |
| --- | |
| **Automated Release by Droidspaces CI** | |
| files: | | |
| release-assets/*.apk | |
| release-assets/*.tar.gz |