.github/workflows/release-build.yaml #135
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 }} | |
| jobs: | |
| build: | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| 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 | |
| run: echo ${{ secrets.GOOGLE_SERVICES }} | base64 -d > ${GITHUB_WORKSPACE}/composeApp/google-services.json | |
| - name: Restore playstore.keystore.jks | |
| run: echo ${{ secrets.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 | |
| run: echo "signing.default.storepassword=${{secrets.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 | |
| run: echo "signing.default.keypassword=${{secrets.KEYSTORE_PASSWORD}}" >> local.properties | |
| - name: Use PostHog API-Key | |
| run: echo "posthog.api.key=${{ secrets.POSTHOG_API_KEY }}" >> local.properties | |
| - name: Add GitLab credentials to local.properties | |
| run: | | |
| echo "GROUP_MAVEN_USERNAME=${{ secrets.GITLAB_USER }}" >> local.properties | |
| echo "GROUP_MAVEN_PASSWORD=${{ secrets.GITLAB_PASSWORD }}" >> local.properties | |
| - name: Disable debug mode | |
| run: echo "app.debug=false" >> local.properties | |
| - name: Create placeholder certificate | |
| run: touch ${GITHUB_WORKSPACE}/composeApp/src/androidMain/res/raw/vocusca.crt | |
| - uses: actions/cache@v4 | |
| 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 :composeApp:assembleRelease | |
| - name: Build App Bundle | |
| run: ./gradlew :composeApp:bundleRelease | |
| - name: Rename output files | |
| run: | | |
| mv composeApp/build/outputs/apk/release/composeApp-release.apk ${{ env.TAG_NAME }}.apk | |
| mv composeApp/build/outputs/bundle/release/composeApp-release.aab ${{ env.TAG_NAME }}.aab | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| ${{ env.TAG_NAME }}.apk | |
| ${{ env.TAG_NAME }}.aab | |
| release: | |
| needs: build | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| ${{ env.TAG_NAME }}.apk | |
| ${{ env.TAG_NAME }}.aab | |
| 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 | |
| - 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 }} |