Updated the version number #10
This file contains 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: Android CI | |
on: | |
push: | |
branches: | |
- main | |
- master | |
- devel | |
- versus-ci-android | |
pull_request: | |
branches: | |
- main | |
- master | |
#defaults: | |
# run: | |
# working-directory: . | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build release-apk | |
steps: | |
- uses: styfle/cancel-workflow-action@0.11.0 | |
with: | |
workflow_id: android-ci.yml | |
all_but_latest: true | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v3 | |
# - uses: nelonoel/branch-name@v1.0.1 | |
- uses: Wohlstand/branch-name@v1.0.1-wohl | |
- name: Pull submodules | |
shell: bash | |
run: | | |
git submodule init | |
git submodule update | |
- name: Install Dependencies | |
shell: bash | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -qq lftp | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3.11.0 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
# Without NDK not compile and not normal error message. NDK is required | |
- name: Install NDK | |
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;22.1.7171670" --sdk_root=${ANDROID_SDK_ROOT} | |
# Some times is have problems with permissions for ./gradle file. Then uncommit it code | |
# - name: Make gradlew executable | |
# run: chmod +x ./gradlew | |
- name: Output version code | |
run: echo VERSION_CODE=${{ github.run_number }} > ./version.properties | |
- name: Import the signing | |
run: echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 -d > release-key.jks | |
- name: Build with Gradle | |
run: ./gradlew bundleReleaseci assembleReleaseci | |
env: | |
RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }} | |
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }} | |
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }} | |
PIN_ALIAS: ${{ secrets.PIN_ALIAS }} | |
DB_PASS_ALIAS: ${{ secrets.DB_PASS_ALIAS }} | |
- name: Rename APK | |
shell: bash | |
run: | | |
if [[ "${BRANCH_NAME}" == *"merge"* ]]; then | |
BRANCH_NAME_RES="pull-request" | |
echo "-- Pull-request detected!" | |
else | |
BRANCH_NAME_RES=${BRANCH_NAME} | |
fi | |
mv OPNMIDI-Player/build/outputs/apk/releaseci/OPNMIDI-Player-releaseci.apk OPNMIDI-Player-android-${BRANCH_NAME_RES}.apk | |
mv OPNMIDI-Player/build/outputs/bundle/releaseci/OPNMIDI-Player-releaseci.aab OPNMIDI-Player-android-${BRANCH_NAME_RES}.aab | |
- name: Upload APK | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OPNMIDI-Player-android-APK | |
path: OPNMIDI-Player-android-*.apk | |
- name: Upload AAB | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OPNMIDI-Player-android-AAB | |
path: OPNMIDI-Player-android-*.aab | |
- name: Deploy to builds.wohlsoft.ru | |
if: success() && github.event_name != 'pull_request' | |
shell: bash | |
run: | | |
if [[ "${BRANCH_NAME}" == *"merge"* ]]; then | |
BRANCH_NAME_RES="pull-request" | |
echo "-- Pull-request detected!" | |
else | |
BRANCH_NAME_RES=${BRANCH_NAME} | |
fi | |
UPLOAD_LIST="set ssl:verify-certificate no;" | |
UPLOAD_LIST="${UPLOAD_LIST} put -O "www/android/" ./OPNMIDI-Player-android-${BRANCH_NAME_RES}.apk;" | |
UPLOAD_LIST="${UPLOAD_LIST} put -O "www/android/" ./OPNMIDI-Player-android-${BRANCH_NAME_RES}.aab;" | |
lftp -e "${UPLOAD_LIST} exit" -u ${{ secrets.builds_login }},${{ secrets.builds_password }} ${{ secrets.builds_host }} | |
- name: List Build Directory | |
if: always() | |
shell: bash | |
run: | | |
git status | |
ls -lR . |