Publish to Play Store #33
Workflow file for this run
This file contains 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
name: Publish to Play Store | |
on: | |
release: | |
types: [published] | |
jobs: | |
pre_publish: | |
name: Validate Version Name | |
runs-on: ubuntu-latest | |
steps: | |
- shell: bash | |
run: | | |
tag_name="${{ github.ref_name }}" | |
if ! [[ $tag_name =~ ^(([0-9]{1}|[1-9]{1}[0-9]{1}))\.(([0-9]{1}|[1-9]{1}[0-9]{1}))\.(([0-9]{1}|[1-9]{1}[0-9]{1}))$ ]]; then | |
echo "Wrong format tag name ${tag_name}" | |
exit 1 | |
fi | |
publish: | |
name: Upload Release Bundle | |
runs-on: ubuntu-latest | |
needs: pre_publish | |
environment: production | |
steps: | |
- name: Checkout The Code | |
uses: actions/checkout@v2 | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Generate Files for Release Bundle | |
env: | |
GOOGLE_SERVICES_JSON: ${{ secrets.RELEASE_GOOGLE_SERVICES_JSON_BASE64 }} | |
REGISTRATION_CREDENTIALS: ${{ secrets.RELEASE_REGISTRATION_CREDENTIALS_BASE64 }} | |
LOCATION_CREDENTIALS: ${{ secrets.RELEASE_LOCATION_CREDENTIALS_BASE64 }} | |
MAPBOX_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} | |
run: | | |
mkdir -p app/src/release/ | |
echo "$GOOGLE_SERVICES_JSON" > google-services.json.b64 | |
base64 -d -i google-services.json.b64 > app/src/release/google-services.json | |
mkdir -p feature/registration/src/release/res/values/ | |
echo "$REGISTRATION_CREDENTIALS" > reg_credentials.xml.b64 | |
base64 -d -i reg_credentials.xml.b64 > feature/registration/src/release/res/values/credentials.xml | |
mkdir -p data/location/src/release/res/values/ | |
echo "$LOCATION_CREDENTIALS" > loc_credentials.xml.b64 | |
base64 -d -i loc_credentials.xml.b64 > data/location/src/release/res/values/credentials.xml | |
echo -e "mapbox.downloads.token=$MAPBOX_DOWNLOAD_TOKEN" > local.properties | |
- name: Make Release Bundle | |
run: bash ./gradlew bundleRelease | |
- name: Sign the Release Bundle | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: app/build/outputs/bundle/release | |
signingKeyBase64: ${{ secrets.RELEASE_PLAY_STORE_UPLOAD_KEY }} | |
alias: ${{ secrets.RELEASE_PLAY_STORE_UPLOAD_KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.RELEASE_PLAY_STORE_UPLOAD_KEY_PWD }} | |
keyPassword: ${{ secrets.RELEASE_PLAY_STORE_UPLOAD_KEY_PWD }} | |
- name: Generate Files for Publishing | |
run: echo "${{ github.event.release.body }}" > whatsnew-en-US | |
- name: Publish to Beta | |
uses: r0adkll/[email protected] | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.PUBLISH_SERVICE_ACCOUNT }} | |
packageName: akio.apps.myrun | |
releaseFiles: app/build/outputs/bundle/release/app-release.aab | |
track: beta | |
whatsNewDirectory: . | |
mappingFile: app/build/outputs/mapping/release/mapping.txt | |
post_publish: | |
name: Create PR to develop | |
runs-on: ubuntu-latest | |
needs: pre_publish | |
steps: | |
- uses: tibdex/github-app-token@v2 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.MYRUN_GITHUB_APP_ID }} | |
private_key: ${{ secrets.MYRUN_GITHUB_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v2 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
- run: | | |
tag_name="${{ github.ref_name }}" | |
ver_nums=(${tag_name//./ }) | |
release_branch="release/${ver_nums[0]}.${ver_nums[1]}" | |
pr_content="Auto PR to merge ${release_branch} into develop" | |
gh pr create --title "${pr_content}" --body "${pr_content}" --label "Auto-PR" --base develop --head "${release_branch}" | |
env: | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} |