This repository was archived by the owner on Dec 6, 2025. It is now read-only.
Merge upstream/main at b25c350 #28
Workflow file for this run
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: Release App | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| # Cannot filter on both branches (release) and tags - it's ORed | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+' | |
| - 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+-rc\.[0-9]+' | |
| - 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+-gplay' | |
| - 'v[0-9]+.[0-9]+.[0-9]+.[0-9]+-rc\.[0-9]+-gplay' | |
| jobs: | |
| release: | |
| name: Release Build and Publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| - name: Ensure release branch | |
| run: | | |
| git config --global --add safe.directory '*' | |
| if ! git branch -a --contains $(git rev-parse HEAD) | grep release >/dev/null; then | |
| echo "Tag is not part of release branch - aborting..." | |
| exit 1 | |
| fi | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Get Go version from Syncthing upstream | |
| id: get_go_version | |
| run: | | |
| set -eu | |
| GO_VERSION=$(grep -E '^\s*GO_VERSION:' syncthing/src/github.com/syncthing/syncthing/.github/workflows/build-syncthing.yaml | head -1 | cut -d '"' -f 2) | |
| echo "go_version=${GO_VERSION}" >> $GITHUB_OUTPUT | |
| echo "GO_VERSION=${GO_VERSION}" >> $GITHUB_ENV | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ steps.get_go_version.outputs.go_version }} | |
| check-latest: true | |
| cache: false | |
| - name: Get Android cmdline-tools version from gradle catalog | |
| id: get_cmdline_tools_version | |
| run: | | |
| set -eu | |
| CMDLINE_TOOLS_VERSION=$(grep 'android-cmdline-tools = ' gradle/libs.versions.toml | cut -d '"' -f 2) | |
| echo "cmdline_tools_version=${CMDLINE_TOOLS_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Install Android SDK | |
| run: | | |
| set -eu | |
| # Set environment variables | |
| echo "ANDROID_HOME=$HOME/android-sdk" >> $GITHUB_ENV | |
| echo "ANDROID_SDK_ROOT=$HOME/android-sdk" >> $GITHUB_ENV | |
| echo "$HOME/android-sdk/cmdline-tools/latest/bin" >> $GITHUB_PATH | |
| echo "Installing Android SDK from scratch" | |
| # Install Android command line tools | |
| SDK_TOOLS_VERSION="${{ steps.get_cmdline_tools_version.outputs.cmdline_tools_version }}" | |
| SDK_TOOLS_FILE="commandlinetools-linux-${SDK_TOOLS_VERSION}_latest.zip" | |
| mkdir -p $HOME/android-sdk/cmdline-tools | |
| cd $HOME/android-sdk/cmdline-tools | |
| wget -q "https://dl.google.com/android/repository/${SDK_TOOLS_FILE}" | |
| unzip -q "${SDK_TOOLS_FILE}" | |
| rm "${SDK_TOOLS_FILE}" | |
| # Move to expected location | |
| mv cmdline-tools latest | |
| # Accept Android licenses | |
| yes | $HOME/android-sdk/cmdline-tools/latest/bin/sdkmanager --licenses | |
| - name: Get app version from libs.versions.toml | |
| id: get_version | |
| run: | | |
| set -eu | |
| VERSION=$(grep 'version-name = ' gradle/libs.versions.toml | cut -d '"' -f 2) | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Extract application ID from gradle config | |
| id: get_app_id | |
| run: | | |
| set -eu | |
| # Extract applicationId dynamically from app/build.gradle.kts using grep and cut | |
| APPLICATION_ID=$(grep "applicationId = " app/build.gradle.kts | cut -d '"' -f 2) | |
| echo "APPLICATION_ID=${APPLICATION_ID}" >> $GITHUB_ENV | |
| echo "Extracted application ID: ${APPLICATION_ID}" | |
| - name: build_release | |
| env: | |
| SYNCTHING_RELEASE_KEY_ALIAS: Syncthing-Fork | |
| SIGNING_PASSWORD: '${{ secrets.SIGNING_PASSWORD }}' | |
| SYNCTHING_RELEASE_STORE_FILE: '${{ runner.temp }}/signing-keystore.jks' | |
| shell: bash | |
| run: | | |
| set -eu | |
| unset ANDROID_NDK_HOME | |
| echo '${{ secrets.SIGNING_KEYSTORE_JKS_BASE64 }}' | base64 -d > "$SYNCTHING_RELEASE_STORE_FILE" | |
| java -version | |
| ./gradlew --no-daemon buildNative lintRelease assembleRelease bundlerelease | |
| rm "$SYNCTHING_RELEASE_STORE_FILE" | |
| - name: prepare-artifacts | |
| shell: bash | |
| run: | | |
| set -eu | |
| # | |
| cd "app/build/outputs" | |
| mv "bundle/release/app-release.aab" "bundle/release/${{ env.APPLICATION_ID }}_gplay_v${{ env.VERSION }}_${{ env.COMMIT_HASH }}.aab" | |
| # | |
| - uses: ncipollo/release-action@v1 | |
| with: | |
| artifacts: "app/build/outputs/apk/release/*.apk,app/build/outputs/bundle/release/*.aab" | |
| artifactErrorsFailBuild: true | |
| name: Syncthing-Fork v${{ env.VERSION }} | |
| bodyFile: "app/src/main/play/release-notes/en-US/default.txt" | |
| prerelease: ${{ contains('-rc.', github.ref_name) }} | |
| draft: true |