diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index b104b586..8b5674b7 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -1,11 +1,15 @@ name: Deploy App Play Store on: + workflow_dispatch: + inputs: + version: + description: 'Github release version' + required: true + type: string push: -# branches: -# - master - tags: - - 'v*' + tags: + - 'v*' jobs: build: @@ -13,37 +17,48 @@ jobs: steps: - uses: actions/checkout@v4 - - - name: Setting up project - uses: ./.github/actions/setup - - name: Build Free Release AAB - id: buildFreeRelease - run: ./gradlew bundleFreeRelease + # Add this step before the 'Post Merged PR to BlueSky' step + - name: Echo Release name + run: | + echo "${{ github.ref_name || github.event.inputs.version }}" - - name: Build Pro Release AAB - id: buildProRelease - run: ./gradlew bundleProRelease - - name: Sign Free AAB - id: signPro - uses: r0adkll/sign-android-release@fix/bundle-signing + - uses: robinraju/release-downloader@v1 with: - releaseDirectory: app/build/outputs/bundle/freeRelease - signingKeyBase64: ${{ secrets.SIGNING_KEY_WITH_PRO }} - alias: ${{ secrets.ALIAS }} - keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} - keyPassword: ${{ secrets.KEY_PASSWORD }} + # The github tag. e.g: v1.0.1 + # Download assets from a specific tag/version + tag: ${{ github.ref_name || github.event.inputs.version }} + # The name of the file to download. + # Use this field only to specify filenames other than tarball or zipball, if any. + # Supports wildcard pattern (eg: '*', '*.deb', '*.zip' etc..) + fileName: 'keypass-free-*.aab' + # Relative path under $GITHUB_WORKSPACE to place the downloaded file(s) + # It will create the target directory automatically if not present + # eg: out-file-path: "my-downloads" => It will create directory $GITHUB_WORKSPACE/my-downloads + out-file-path: 'app/build/outputs/bundle/freeRelease' + # Github access token to download files from private repositories + # https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets + # eg: token: ${{ secrets.MY_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} - - name: Sign Pro AAB - id: sign - uses: r0adkll/sign-android-release@fix/bundle-signing + - uses: robinraju/release-downloader@v1 with: - releaseDirectory: app/build/outputs/bundle/proRelease - signingKeyBase64: ${{ secrets.SIGNING_KEY_WITH_PRO }} - alias: pro - keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} - keyPassword: ${{ secrets.KEY_PASSWORD }} + # The github tag. e.g: v1.0.1 + # Download assets from a specific tag/version + tag: ${{ github.ref_name || github.event.inputs.version }} + # The name of the file to download. + # Use this field only to specify filenames other than tarball or zipball, if any. + # Supports wildcard pattern (eg: '*', '*.deb', '*.zip' etc..) + fileName: 'keypass-pro-*.aab' + # Relative path under $GITHUB_WORKSPACE to place the downloaded file(s) + # It will create the target directory automatically if not present + # eg: out-file-path: "my-downloads" => It will create directory $GITHUB_WORKSPACE/my-downloads + out-file-path: 'app/build/outputs/bundle/proRelease' + # Github access token to download files from private repositories + # https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets + # eg: token: ${{ secrets.MY_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Create service_account.json id: createServiceAccount @@ -73,15 +88,15 @@ jobs: status: inProgress whatsNewDirectory: whatsnew/ - - name: Deploy Free to Indus App Store - id: uploadToIndus - uses: yogeshpaliyal/upload-indus-appstore@v0.0.6 - with: - type: UPLOAD_AAB - apiKey: ${{secrets.INDUS_API_KEY}} - packageName: com.yogeshpaliyal.keypass - aabFile: app/build/outputs/bundle/freeRelease/*.aab - signingKeyBase64: ${{ secrets.SIGNING_KEY }} - keystoreAlias: ${{ secrets.ALIAS }} - keystorePassword: ${{ secrets.KEY_STORE_PASSWORD }} - keyPassword: ${{ secrets.KEY_PASSWORD }} +# - name: Deploy Free to Indus App Store +# id: uploadToIndus +# uses: yogeshpaliyal/upload-indus-appstore@v0.0.6 +# with: +# type: UPLOAD_AAB +# apiKey: ${{secrets.INDUS_API_KEY}} +# packageName: com.yogeshpaliyal.keypass +# aabFile: app/build/outputs/bundle/freeRelease/*.aab +# signingKeyBase64: ${{ secrets.SIGNING_KEY }} +# keystoreAlias: ${{ secrets.ALIAS }} +# keystorePassword: ${{ secrets.KEY_STORE_PASSWORD }} +# keyPassword: ${{ secrets.KEY_PASSWORD }} diff --git a/.github/workflows/uploadBuildOnTag.yaml b/.github/workflows/uploadBuildOnTag.yaml index ad66fc01..bd2e9f98 100644 --- a/.github/workflows/uploadBuildOnTag.yaml +++ b/.github/workflows/uploadBuildOnTag.yaml @@ -1,9 +1,9 @@ name: Upload build on release tag on: - push: - tags: - - '*' +# push: +# tags: +# - '*' workflow_dispatch: inputs: tag: diff --git a/.github/workflows/version-bump.yaml b/.github/workflows/version-bump.yaml index c7576a3e..6ab1d8a8 100644 --- a/.github/workflows/version-bump.yaml +++ b/.github/workflows/version-bump.yaml @@ -22,10 +22,6 @@ jobs: steps: - uses: actions/checkout@v4 - # - name: Checkout - # run: | - # git checkout -b autoVersionBump - - name: 🏗 Bump App Version id: bump-app-version run: | @@ -47,6 +43,34 @@ jobs: - name: Print newVersion run: echo "${{ steps.bump-app-version.outputs.newVersion }}" + - name: Build Free Release AAB + id: buildFreeRelease + run: ./gradlew bundleFreeRelease + + - name: Build Pro Release AAB + id: buildProRelease + run: ./gradlew bundleProRelease + + - name: Sign Free AAB + id: signPro + uses: r0adkll/sign-android-release@fix/bundle-signing + with: + releaseDirectory: app/build/outputs/bundle/freeRelease + signingKeyBase64: ${{ secrets.SIGNING_KEY_WITH_PRO }} + alias: ${{ secrets.ALIAS }} + keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} + keyPassword: ${{ secrets.KEY_PASSWORD }} + + - name: Sign Pro AAB + id: sign + uses: r0adkll/sign-android-release@fix/bundle-signing + with: + releaseDirectory: app/build/outputs/bundle/proRelease + signingKeyBase64: ${{ secrets.SIGNING_KEY_WITH_PRO }} + alias: pro + keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} + keyPassword: ${{ secrets.KEY_PASSWORD }} + - name: Push to protected branch uses: CasperWA/push-protected@v2 with: @@ -59,6 +83,12 @@ jobs: git tag -a ${{ steps.bump-app-version.outputs.newVersion }} -m "Release version ${{ steps.bump-app-version.outputs.newVersion }}" git push origin ${{ steps.bump-app-version.outputs.newVersion }} + - name: Rename aab names + run: | + mkdir -p app/build/outputs/bundle/release + mv app/build/outputs/bundle/freeRelease/app-free-release.aab app/build/outputs/bundle/release/keypass-free-${{steps.bump-app-version.outputs.newVersion}}.aab + mv app/build/outputs/bundle/proRelease/app-pro-release.aab app/build/outputs/bundle/release/keypass-pro-${{steps.bump-app-version.outputs.newVersion}}.aab + - name: Create Release uses: ncipollo/release-action@v1.16.0 @@ -66,9 +96,45 @@ jobs: tag: "${{ steps.bump-app-version.outputs.newVersion }}" generateReleaseNotes: true commit: "master" + artifacts: "app/build/outputs/bundle/release/*.aab" discussionCategory: "Release feedbacks" makeLatest: true - # - name: Create Pull Request - # uses: peter-evans/create-pull-request@v5.0.0 + - uses: snnaplab/universal-apk-generate-action@v1 + id: apk-free-generate + with: + aab-path: 'app/build/outputs/bundle/release/keypass-free-${{steps.bump-app-version.outputs.newVersion}}.aab' + keystore-base64: ${{ secrets.SIGNING_KEY_WITH_PRO }} + keystore-password: ${{ secrets.KEY_STORE_PASSWORD }} + key-alias: ${{ secrets.ALIAS }} + key-password: ${{ secrets.KEY_PASSWORD }} + - name: Upload free binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ steps.apk-free-generate.outputs.apk-path }} + asset_name: 'keypass-free-${{steps.bump-app-version.outputs.newVersion}}.apk' + tag: ${{ steps.bump-app-version.outputs.newVersion }} + overwrite: true + + - name: Remove universal directory + run: rm -r /home/runner/work/snnaplab-universal-apk-generate-action + + - uses: snnaplab/universal-apk-generate-action@v1 + id: apk-pro-generate + with: + aab-path: 'app/build/outputs/bundle/release/keypass-pro-${{steps.bump-app-version.outputs.newVersion}}.aab' + keystore-base64: ${{ secrets.SIGNING_KEY_WITH_PRO }} + keystore-password: ${{ secrets.KEY_STORE_PASSWORD }} + key-alias: pro + key-password: ${{ secrets.KEY_PASSWORD }} + + - name: Upload pro binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ steps.apk-pro-generate.outputs.apk-path }} + tag: ${{ steps.bump-app-version.outputs.newVersion }} + asset_name: 'keypass-pro-${{ steps.bump-app-version.outputs.newVersion }}.apk' + overwrite: true