Skip to content

Commit

Permalink
Generate "fastlane changelog" and "google play whats new" from releas…
Browse files Browse the repository at this point in the history
…e body (#322)
  • Loading branch information
frimtec authored May 25, 2022
1 parent 4364763 commit 895707b
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 14 deletions.
68 changes: 61 additions & 7 deletions .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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/[email protected]
Expand All @@ -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
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/[email protected]
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 "[email protected]"
git config --local user.email "[email protected]"
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/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: 'master'
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 0 additions & 3 deletions google-play/whatsnew/whatsnew-de-DE

This file was deleted.

3 changes: 0 additions & 3 deletions google-play/whatsnew/whatsnew-en-US

This file was deleted.

0 comments on commit 895707b

Please sign in to comment.