New Crowdin updates #89
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
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'app/**' | |
name: do-pr-prerelease | |
jobs: | |
build-and-upload: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout PR Head | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
token: ${{secrets.ACTIONS_PAT}} | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/branch-names@v6 | |
- name: Count existing APKs | |
id: count-apks | |
run: | | |
APK_COUNT=$(curl -s "https://api.github.com/repos/${{ github.repository }}/contents?ref=artifacts" | grep -o '"name": ".*${{ steps.branch-name.outputs.current_branch }}-Field-Book.apk"' | wc -l) | |
echo "APK_NUMBER=$((APK_COUNT + 1))" >> $GITHUB_ENV | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '11' | |
- name: Make gradlew executable | |
run: chmod +x ./gradlew | |
- name: Build APK | |
run: ./gradlew app:assembleRelease | |
- name: Sign APK | |
uses: r0adkll/sign-android-release@v1 | |
id: sign_app | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
- name: Upload built APK | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Build Artifacts | |
path: app/build/outputs/ | |
- name: Rename APK file | |
run: | | |
FULL_BRANCH=${{ steps.branch-name.outputs.current_branch }} | |
BRANCH=${FULL_BRANCH##*/} | |
APK_NUMBER=${{ env.APK_NUMBER }} | |
echo "BRANCH=$BRANCH" >> $GITHUB_ENV | |
mv app/build/outputs/apk/release/app-release-unsigned-signed.apk "app/build/outputs/apk/release/${APK_NUMBER}-${BRANCH}-Field-Book.apk" | |
- name: Attach APK to PR using artifacts branch | |
uses: gavv/pull-request-artifacts@v1.0.0 | |
with: | |
commit: ${{ github.event.pull_request.head.sha }} | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts-branch: artifacts | |
artifacts: | | |
app/build/outputs/apk/release/${{ env.APK_NUMBER }}-${{ env.BRANCH }}-Field-Book.apk |