Skip to content

[Bump] Android version to 1.3.8 (43) #356

[Bump] Android version to 1.3.8 (43)

[Bump] Android version to 1.3.8 (43) #356

Workflow file for this run

name: Android CI
on:
push:
paths:
- ".github/workflows/android.yml"
- "XClipper.Android/**"
pull_request:
paths:
- ".github/workflows/android.yml"
- "XClipper.Android/**"
jobs:
android:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.gradle.kts*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: Extract required files
run: |
echo "${{ secrets.GRADLE_LIBRARY_UTILS }}" > lu.base64
certutil -decode lu.base64 lu.tar.gz
tar -xvzf lu.tar.gz
echo "${{ secrets.KEY_JKS }}" > key.base64
certutil -decode key.base64 "${{github.workspace}}\XClipper.Android\key.jks"
echo "${{ secrets.GOOGLE_SERVICES_JSON }}" > google-services.json.base64
certutil -decode google-services.json.base64 "${{ github.workspace }}\XClipper.Android\app\google-services.json"
- name: Fill required properties
run: |
md XClipper.Android/.gradle
echo SERVER_URI=${{ secrets.SERVER_URI }} >> "${{github.workspace}}\XClipper.Android\.gradle\gradle.properties"
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> "${{github.workspace}}\XClipper.Android\.gradle\gradle.properties"
echo keyAlias=${{ secrets.KEY_ALIAS }} >> "${{github.workspace}}\XClipper.Android\.gradle\gradle.properties"
echo keyPassword=${{ secrets.KEY_PASSWORD }} >> "${{github.workspace}}\XClipper.Android\.gradle\gradle.properties"
echo storePassword=${{ secrets.STORE_PASSWORD }} >> "${{github.workspace}}\XClipper.Android\.gradle\gradle.properties"
- name: Extracting version infos
id: versions
shell: pwsh
run: |
$tag = (findstr /L VERSION_NAME "${{github.workspace}}\XClipper.Android\buildSrc\src\main\java\AndroidConfig.kt").Split("=")[1].Trim().Replace('"',"")
echo "Version is $tag"
echo "::set-output name=TAG_NAME::$tag"
- run: |
cd XClipper.Android
chmod +x gradlew
- name: Assemble release
run: |
cd XClipper.Android
./gradlew app:assembleRelease --stacktrace --scan
./gradlew --stop
if (-Not (Test-Path -Path '${{github.workspace}}\XClipper.Android\app\build\outputs\apk\release\app-release.apk' -PathType Leaf)) { exit 1 }
- name: Draft Release
id: create_release
uses: actions/create-release@v1
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.versions.outputs.TAG_NAME }}
release_name: v${{ steps.versions.outputs.TAG_NAME }}
body_path: ${{ github.workspace }}\scripts\changes.txt
draft: true
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./XClipper.Android/app/build/outputs/apk/release/app-release.apk
asset_name: XClipper-v${{ steps.versions.outputs.TAG_NAME }}.apk
asset_content_type: application/octet-stream
- name: Creating some output variables
id: vars
run: echo "::set-output name=sha_short::$(echo ${{ github.sha }} | cut -c -7)"
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: XClipper.apk-snapshot-${{ steps.vars.outputs.sha_short }}
path: XClipper.Android/app/build/outputs/apk/release
draft_remove:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Remove Old Release Drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases \
| tr '\r\n' ' ' \
| jq '.[] | select( .assets[].browser_download_url | contains (".apk") ) | select(.draft == true) | .id' \
| xargs -I '{}' \
curl -X DELETE -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/{}
# Common action to notify on discord
discord_notify:
needs: [android]
runs-on: ubuntu-latest
steps:
- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(echo ${{ github.sha }} | cut -c -7)"
- name: Sending commit notification
if: (!startsWith(github.event.pusher, '')) && startsWith(github.event.pusher.name, 'KaustubhPatange')
env:
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK_ANDROID }}
uses: Ilshidur/action-discord@master
with:
args: Commit [${{ steps.vars.outputs.sha_short }}](${{github.event.repository.html_url}}/commit/${{ github.sha }}) had a successful build!
- name: Sending PR notification
if: (!startsWith(github.event.pull_request, ''))
env:
DISCORD_WEBHOOK: ${{ secrets.WEBHOOK_PC }}
uses: Ilshidur/action-discord@master
with:
args: "A new pull request is made by ${{ github.event.pull_request.user.login }}. Review it [here](${{ github.event.pull_request.html_url }})!"