diff --git a/.github/workflows/deploy_release.yml b/.github/workflows/deploy_release.yml index 10621f61..4a7ed03c 100644 --- a/.github/workflows/deploy_release.yml +++ b/.github/workflows/deploy_release.yml @@ -2,13 +2,16 @@ name: Deploy release on: release: - types: [created] + types: [prereleased, released] jobs: deploy: runs-on: ubuntu-18.04 + outputs: + VCODE: ${{ steps.get_vcode.outputs.VCODE }} + steps: - uses: actions/checkout@v3 @@ -32,15 +35,15 @@ jobs: run: | sed -i 's/$version/${{ steps.get_version.outputs.VERSION }}/g' app/version.properties - - name: Get VCODE_TIME - id: get_vcode_time - run: echo ::set-output name=VCODE_TIME::$(date +%s) + - name: Get VCODE + id: get_vcode + run: echo ::set-output name=VCODE::$(expr $(date +%s) / 60 - 26797800) - name: Build APK - run: bash ./gradlew assembleRelease --stacktrace -Dversion.code.time=${{ steps.get_vcode_time.outputs.VCODE_TIME }} -Dpurchase.validation.key=${{ secrets.PURCHASE_VALIDATION_KEY }} + run: bash ./gradlew assembleRelease --stacktrace -Dversion.code=${{ steps.get_vcode.outputs.VCODE }} -Dpurchase.validation.key=${{ secrets.PURCHASE_VALIDATION_KEY }} - name: Build AAB - run: bash ./gradlew :app:bundleRelease --stacktrace -Dversion.code.time=${{ steps.get_vcode_time.outputs.VCODE_TIME }} -Dpurchase.validation.key=${{ secrets.PURCHASE_VALIDATION_KEY }} + run: bash ./gradlew :app:bundleRelease --stacktrace -Dversion.code=${{ steps.get_vcode.outputs.VCODE }} -Dpurchase.validation.key=${{ secrets.PURCHASE_VALIDATION_KEY }} - uses: r0adkll/sign-android-release@v1 name: Sign app APK @@ -81,6 +84,13 @@ jobs: id: get_track run: echo ::set-output name=TRACK::$(if [[ "${{ steps.get_release.outputs.prerelease }}" == "false" ]] ; then echo production ; else echo alpha ; fi) + - name: Generate whatsnew + id: generate_whatsnew + run: | + mkdir -p google-play/whatsnew + echo "${{ steps.get_release.outputs.body }}" | sed '/^-/!d;s/- #[[:digit:]]\+ \(.*\) @\(.*\)/- \1/g' >> google-play/whatsnew/whatsnew-de-DE + echo "${{ steps.get_release.outputs.body }}" | sed '/^-/!d;s/- #[[:digit:]]\+ \(.*\) @\(.*\)/- \1/g' >> google-play/whatsnew/whatsnew-en-US + - name: Upload AAB Google Play id: upload-release-asset-aab uses: r0adkll/upload-google-play@v1.0.15 @@ -89,4 +99,48 @@ jobs: packageName: com.github.frimtec.android.pikettassist releaseFiles: ${{steps.sign_app_aab.outputs.signedReleaseFile}} track: ${{ steps.get_track.outputs.TRACK }} - whatsNewDirectory: google-play/whatsnew \ No newline at end of file + whatsNewDirectory: google-play/whatsnew + + update-repo: + + runs-on: ubuntu-latest + needs: deploy + + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + + - name: Checkout master + run: | + git checkout master + + - name: Get release + id: get_release + uses: bruceadams/get-release@v1.2.3 + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Create fastlane changelog + run: | + mkdir -p fastlane/metadata/android/en-US/changelogs + echo "${{ steps.get_release.outputs.body }}" | sed '/^-/!d;s/- #[[:digit:]]\+ \(.*\) @\(.*\)/- \1/g' | head -n 10 >> fastlane/metadata/android/en-US/changelogs/${{needs.deploy-apk.outputs.VCODE}}.txt + + - name: Commit changes + run: | + git config --local user.email "action@github.com" + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add fastlane/metadata/android/en-US/changelogs/${{needs.deploy-apk.outputs.VCODE}}.txt + git commit -m "Update release changelog for ${{ steps.get_version.outputs.VERSION }}" + + - name: Push changes + uses: ad-m/github-push-action@v0.6.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: 'master' \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index d4603c93..75b28d85 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,7 +24,7 @@ if (versionPropsFile.exists()) { versionProps.load(new FileInputStream(versionPropsFile)) } -int vcode = (Integer.parseInt(System.getProperty("version.code.time", String.valueOf((int) (System.currentTimeMillis() / 1000)))) / 60) - 26_797_800 +int vcode = Integer.parseInt(System.getProperty("version.code", String.valueOf((int) ((System.currentTimeMillis() / 1000 / 60) - 26_797_800)))) String vname = (versionProps['VERSION_NAME'] == null || versionProps['VERSION_NAME'].startsWith('$')) ? '0.0.0' : versionProps['VERSION_NAME'] def purchaseValidationKeyProperties = new Properties() diff --git a/google-play/whatsnew/whatsnew-de-DE b/google-play/whatsnew/whatsnew-de-DE deleted file mode 100644 index 22d1828f..00000000 --- a/google-play/whatsnew/whatsnew-de-DE +++ /dev/null @@ -1,3 +0,0 @@ -Funktionen und Verbesserungen: -* Das Recht REQUEST_INSTALL_PACKAGES wurde aus der Applikation entfernt (neue Google-Play Policy). - Der SMS-Adapter S2MSP wird neu via Browser installiert. diff --git a/google-play/whatsnew/whatsnew-en-US b/google-play/whatsnew/whatsnew-en-US deleted file mode 100644 index 327042fb..00000000 --- a/google-play/whatsnew/whatsnew-en-US +++ /dev/null @@ -1,3 +0,0 @@ -Features and improvements: -* The permission REQUEST_INSTALL_PACKAGES has been removed from the app (new Google-Play policy). - The SMS adapter S2MSP will be installed via browser now. \ No newline at end of file