.github/workflows/release-build.yaml #253
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
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| env: | |
| TAG_NAME: ${{ github.ref_name }} | |
| concurrency: | |
| group: production-upload-${{ github.workflow }} | |
| cancel-in-progress: false | |
| jobs: | |
| build-android: | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v5 | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 17 | |
| cache: 'gradle' | |
| cache-dependency-path: | | |
| ${{ github.workspace }}/gradle/wrapper/gradle-wrapper.properties | |
| ${{ github.workspace }}/**/*.versions.toml | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Make gradlew executable | |
| run: chmod +x ./gradlew | |
| - name: Restore google-services.json | |
| env: | |
| GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} | |
| run: echo "$GOOGLE_SERVICES" | base64 -d > ${GITHUB_WORKSPACE}/androidApp/google-services.json | |
| - name: Restore playstore.keystore.jks | |
| env: | |
| KEYSTORE_FILE: ${{ secrets.KEYSTORE_FILE }} | |
| run: echo "$KEYSTORE_FILE" | base64 -d > ${GITHUB_WORKSPACE}/keystore.jks | |
| - name: Add keystore information to local.properties | |
| run: echo "signing.default.file=${GITHUB_WORKSPACE}/keystore.jks" >> local.properties | |
| - name: Add keystore password to local.properties | |
| env: | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| run: echo "signing.default.storepassword=$KEYSTORE_PASSWORD" >> local.properties | |
| - name: Add keystore alias to local.properties | |
| run: echo "signing.default.keyalias=key0" >> local.properties | |
| - name: Add keystore key password to local.properties | |
| env: | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| run: echo "signing.default.keypassword=$KEYSTORE_PASSWORD" >> local.properties | |
| - name: Use PostHog API-Key | |
| env: | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | |
| run: echo "posthog.api.key=$POSTHOG_API_KEY" >> local.properties | |
| - name: Add GitLab credentials to local.properties | |
| env: | |
| GITLAB_USER: ${{ secrets.GITLAB_USER }} | |
| GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} | |
| run: | | |
| echo "GROUP_MAVEN_USERNAME=$GITLAB_USER" >> local.properties | |
| echo "GROUP_MAVEN_PASSWORD=$GITLAB_PASSWORD" >> local.properties | |
| - name: Disable debug mode | |
| run: echo "app.debug=false" >> local.properties | |
| - uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/libs.versions.toml', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Build APK | |
| run: ./gradlew :androidApp:assembleRelease | |
| - name: Build App Bundle | |
| run: ./gradlew :androidApp:bundleRelease | |
| - name: Rename output files | |
| run: | | |
| mv androidApp/build/outputs/apk/release/androidApp-release.apk ${{ env.TAG_NAME }}.apk | |
| mv androidApp/build/outputs/bundle/release/androidApp-release.aab ${{ env.TAG_NAME }}.aab | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| ${{ env.TAG_NAME }}.apk | |
| ${{ env.TAG_NAME }}.aab | |
| build-ios: | |
| runs-on: macos-self | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v5 | |
| - name: Setup Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 17 | |
| - name: Make gradlew executable | |
| run: chmod +x ./gradlew | |
| - name: Add GitLab credentials to local.properties | |
| env: | |
| GITLAB_USER: ${{ secrets.GITLAB_USER }} | |
| GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }} | |
| run: | | |
| echo "GROUP_MAVEN_USERNAME=$GITLAB_USER" >> local.properties | |
| echo "GROUP_MAVEN_PASSWORD=$GITLAB_PASSWORD" >> local.properties | |
| - name: Use PostHog API-Key | |
| env: | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | |
| run: echo "posthog.api.key=$POSTHOG_API_KEY" >> local.properties | |
| - name: Disable debug mode | |
| run: echo "app.debug=false" >> local.properties | |
| - name: Generate iOS version configuration | |
| run: ./gradlew :composeApp:generateXcodeVersionConfig | |
| - name: Decode certificate | |
| run: echo "${{ secrets.IOS_CERTIFICATE_P12 }}" | base64 -d > iosApp/ci_certificate.p12 | |
| - name: Decode provisioning profile | |
| run: echo "${{ secrets.IOS_PROVISIONING_PROFILE }}" | base64 -d > iosApp/ci_profile.mobileprovision | |
| - name: Build IPA | |
| working-directory: iosApp | |
| env: | |
| IOS_CERTIFICATE_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }} | |
| APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} | |
| APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} | |
| APP_STORE_KEY_CONTENT: ${{ secrets.APP_STORE_KEY_CONTENT }} | |
| IPA_OUTPUT_DIR: ${{ github.workspace }}/iosApp/build | |
| run: fastlane ios build_ipa | |
| - name: Cleanup sensitive files | |
| if: always() | |
| run: rm -f iosApp/ci_certificate.p12 iosApp/ci_profile.mobileprovision | |
| - name: Upload IPA artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ios-build-artifacts | |
| path: iosApp/build/VPlanPlus.ipa | |
| release: | |
| needs: [build-android, build-ios] | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| steps: | |
| - name: Download Android build artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: build-artifacts | |
| - name: Download iOS build artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: ios-build-artifacts | |
| - name: Rename IPA | |
| run: mv VPlanPlus.ipa ${{ env.TAG_NAME }}.ipa | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| ${{ env.TAG_NAME }}.apk | |
| ${{ env.TAG_NAME }}.aab | |
| ${{ env.TAG_NAME }}.ipa | |
| draft: false | |
| prerelease: ${{ endsWith(env.TAG_NAME, '-closed') || endsWith(env.TAG_NAME, '-open') || endsWith(env.TAG_NAME, '-internal') }} | |
| make_latest: true | |
| name: VPlanPlus ${{ env.TAG_NAME }} | |
| fail_on_unmatched_files: true | |
| deploy-android: | |
| needs: release | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| steps: | |
| - name: Download Android build artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: build-artifacts | |
| - name: Deploy on Google Play | |
| uses: r0adkll/upload-google-play@v1 | |
| with: | |
| serviceAccountJsonPlainText: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }} | |
| packageName: plus.vplan.app | |
| releaseFiles: ${{ env.TAG_NAME }}.aab | |
| track: ${{ endsWith(env.TAG_NAME, '-internal') && 'internal' || endsWith(env.TAG_NAME, '-closed') && 'alpha' || endsWith(env.TAG_NAME, '-open') && 'beta' || 'production' }} | |
| releaseName: ${{ env.TAG_NAME }} | |
| deploy-ios: | |
| needs: release | |
| runs-on: macos-self | |
| if: ${{ !endsWith(github.ref_name, '-production') }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v5 | |
| - name: Download iOS build artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: ios-build-artifacts | |
| path: iosApp/build | |
| - name: Determine lane and upload to TestFlight | |
| working-directory: iosApp | |
| env: | |
| APP_STORE_KEY_ID: ${{ secrets.APP_STORE_KEY_ID }} | |
| APP_STORE_ISSUER_ID: ${{ secrets.APP_STORE_ISSUER_ID }} | |
| APP_STORE_KEY_CONTENT: ${{ secrets.APP_STORE_KEY_CONTENT }} | |
| run: | | |
| if [[ "${{ env.TAG_NAME }}" == *-internal ]]; then | |
| fastlane ios internal | |
| elif [[ "${{ env.TAG_NAME }}" == *-closed ]]; then | |
| fastlane ios closed | |
| elif [[ "${{ env.TAG_NAME }}" == *-open ]]; then | |
| fastlane ios open | |
| else | |
| echo "No matching lane for tag ${{ env.TAG_NAME }}" | |
| exit 1 | |
| fi |