From 7b19a70b48769bd0e8fc208ee5f2ea9af2fc02ff Mon Sep 17 00:00:00 2001 From: hoeveid Date: Wed, 8 Jan 2025 00:09:56 +0100 Subject: [PATCH] workflow to automatically build apks --- .github/workflows/android.yml | 91 --------------------------------- .github/workflows/brands.yml | 96 ----------------------------------- 2 files changed, 187 deletions(-) delete mode 100644 .github/workflows/android.yml delete mode 100644 .github/workflows/brands.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml deleted file mode 100644 index bf35cb8..0000000 --- a/.github/workflows/android.yml +++ /dev/null @@ -1,91 +0,0 @@ -# OLD, not longer needed?. We use buildrelease.yml and deploy.yml -name: Build & Publish Release APK - -on: - workflow_dispatch: # run manually - push: - tags: - - 'Release*' - -jobs: - build: - runs-on: ubuntu-latest - - steps: -# - name: get the date -# id: date -# run: | -# NOW=$(date +"%Y%m%d") -# echo "now=${NOW}" >> $GITHUB_OUTPUT - - - name: Setup Java JDK - uses: - actions/setup-java@v4.2.1 - with: - java-version: 11 - distribution: 'adopt' - - - name: Checkout the code - uses: actions/checkout@v4.1.7 - - - name: Make pipeline script files executable where needed - run: chmod +x ./gradlew ./build.gradle.adapt.for.github.workflow.sh ./change.R.package.sh - - - name: Adapt build.gradle and google-services.json by means of script - env: - GSM_API_KEY: ${{ secrets.GSM_API_KEY }} - run: ./build.gradle.adapt.for.github.workflow.sh ${GSM_API_KEY} - - - name: adapt sources and res files to build different brand - run: ./change.R.package.sh Squore - - - name: Build unsigned release .apk files - run: ./gradlew build - - - name: Sign .apk files - env: - KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} - KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} - run: | - echo "${KEYSTORE_BASE64}" | base64 -d > apksign.keystore - set -x - androidhome="${ANDROID_HOME:-${ANDROID_SDK}}" - for unsignedFn in build/outputs/apk/*/release/*.apk; do - signedFn=${unsignedFn/release-unsigned/release-signed} - ${androidhome}/build-tools/$(ls ${androidhome}/build-tools/ | tail -1)/apksigner sign --ks apksign.keystore --ks-pass pass:"${KEYSTORE_PASSWORD}" --out "${signedFn}" "${unsignedFn}" - done - rm -v apksign.keystore - - - name: Extract the version from build.gradle - id: extract_version - run: | - VERSION=$(grep 'def\s*versionCodeXXX' build.gradle | cut -d '=' -f 2 | tr -d ' ') - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Upload artifact for phone - uses: actions/upload-artifact@v4.3.4 - with: - name: Squore.phone.${{ steps.extract_version.outputs.version }}.apk - path: build/outputs/apk/phoneTabletPost23/release/Squore-phoneTabletPost23-release-signed.apk - - - name: Upload artifact for wearOs - uses: actions/upload-artifact@v4.3.4 - with: - name: Squore.wearOs.${{ steps.extract_version.outputs.version }}.apk - path: build/outputs/apk/wearOs/release/Squore-wearOs-release-signed.apk - - - name: Create upload .apk to /releases - uses: ncipollo/release-action@v1 - with: - token: ${{ secrets.GH_ACCESS_TOKEN }} - tag: "${{ steps.extract_version.outputs.version }}" - #prerelease: "${{ steps.extract_version.outputs.beta }}" - #draft: "${{ inputs.draft }}" - artifacts: ./build/outputs/apk/*/release/*-*-release-signed.apk - generateReleaseNotes: false - - #- name: Releasing using Hub - # uses: sangatdesai/release-apk@main - # env: - # GITHUB_TOKEN: ${{ secrets.TOKEN }} - # APP_FOLDER: app diff --git a/.github/workflows/brands.yml b/.github/workflows/brands.yml deleted file mode 100644 index 7cfb990..0000000 --- a/.github/workflows/brands.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Build & Publish Several brands OOO - -on: - workflow_dispatch: # run manually - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - brand: - - Badminton - - Racketlon - - Squore - - Tabletennis - - TennisPadel - - steps: - - - name: Setup Java JDK - uses: - actions/setup-java@v4.2.1 - with: - java-version: 11 - distribution: 'adopt' - - - name: Checkout the code - uses: actions/checkout@v4.1.7 - with: - repository: ${{ github.repository }} # =obbimi/Squore , the default - #ref: main - - - name: Make pipeline script files executable where needed - run: chmod +x ./gradlew ./build.gradle.adapt.for.github.workflow.sh ./change.R.package.sh - - - name: Adapt build.gradle and google-services.json by means of script - env: - GSM_API_KEY: ${{ secrets.GSM_API_KEY }} - run: ./build.gradle.adapt.for.github.workflow.sh ${GSM_API_KEY} - - - name: adapt sources and res files to build different brand - run: | - set -x - brand=${{ matrix.brand }} - ./change.R.package.sh ${brand} - - - name: Extract the version from build.gradle - id: extract_version - run: | - VERSION=$(grep '^\s*versionCode' build.gradle | cut -d '+' -f 2 | sort -u | tr -d ' ') - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Wait a bit to ensure all matrix file go into same release - if: ${{ matrix.brand != 'Badminton' }} - run: | - if [ '${{ matrix.brand }}' != "Badminton" ]; then - sleep 90 - fi - - - name: Build unsigned release .apk files - run: ./gradlew build - - - name: Sign .apk files - env: - KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} - KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} - run: | - set -x - brand=${{ matrix.brand }} - echo "${KEYSTORE_BASE64}" | base64 -d > apksign.keystore - androidhome="${ANDROID_HOME:-${ANDROID_SDK}}" - for unsignedFn in build/outputs/apk/*/release/*.apk; do - unbrandedSignedFn=${unsignedFn/release-unsigned/release-signed} - signedFn=${unbrandedSignedFn/Squore/${brand}.${{ steps.extract_version.outputs.version }}} - ${androidhome}/build-tools/$(ls ${androidhome}/build-tools/ | tail -1)/apksigner sign --ks apksign.keystore --ks-pass pass:"${KEYSTORE_PASSWORD}" --out "${signedFn}" "${unsignedFn}" - done - rm -v apksign.keystore - - #- name: Create upload .apk to /releases (ncipollo) - # uses: ncipollo/release-action@v1 - # with: - # token: ${{ secrets.GH_ACCESS_TOKEN }} - # tag: "Release.${{ steps.extract_version.outputs.version }}" - # artifacts: ./build/outputs/apk/*/release/*-*-release-signed.apk - # generateReleaseNotes: false - # draft: true # Sets the release as a draft instead of publishing it, allowing you to make any edits needed before releasing - - - name: Create upload .apk to /releases (softprops) - uses: softprops/action-gh-release@v2 - with: - draft: true # Sets the release as a draft instead of publishing it, allowing you to make any edits needed before releasing - token: ${{ secrets.GH_ACCESS_TOKEN }} - tag_name: "Release.${{ steps.extract_version.outputs.version }}" - files: ./build/outputs/apk/*/release/*-*-release-signed.apk - generate_release_notes: false