Fix(Build): use main branch for deploy alpha #55
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: GLPI Android Inventory Library Deploy Alpha | |
env: | |
module_app: app | |
on: | |
push: | |
branches: | |
- "main" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
################################ | |
# Update Version Code # | |
################################ | |
- name: Update Android Version code | |
run: ./gradlew updateVersionCode | |
- name: Extract Release Version | |
run: echo "release_version=$(jq -r ".version" package.json)" >> $GITHUB_ENV | |
- name: Extract App VersionCode | |
run: echo "app_version_code=$(grep versionCode ./app/src/main/AndroidManifest.xml | cut -d\" -f2)" >> $GITHUB_ENV | |
- name: Update About Data | |
run : | | |
echo "about.version=${{ env.release_version }}" > ./app/src/main/assets/about.properties | |
echo "about.build=${{ env.app_version_code }}" >> ./app/src/main/assets/about.properties | |
echo "about.date=$(date "+%a %b %d %H:%M:%S %Y")" >> ./app/src/main/assets/about.properties | |
echo "about.commit=$(git rev-parse --short "$GITHUB_SHA")" >> ./app/src/main/assets/about.properties | |
echo "about.commitFull=$(git rev-parse "$GITHUB_SHA")" >> ./app/src/main/assets/about.properties | |
echo "about.github=https://github.com/glpi-project/android-inventory-agent" >> ./app/src/main/assets/about.properties | |
- name: Push Updated Version On AndroidManifest | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
message: "ci(release): update version on android manifest" | |
########################################## | |
# Push / Pull translation files # | |
########################################## | |
# Push Transifex | |
- name: Push source file using transifex client | |
uses: transifex/cli-action@v2 | |
with: | |
args: push | |
token: ${{ secrets.TX_TOKEN }} | |
# Clean Transifex CLI | |
- name: Clean Transifex CLI | |
run: rm -fr /tmp/tx | |
# Pull from Transifex | |
- name: Pull source file using transifex client | |
uses: transifex/cli-action@v2 | |
with: | |
args: pull --force --all --minimum-perc=80 | |
token: ${{ secrets.TX_TOKEN }} | |
############################################## | |
# Prepare / Build project APK / AAR / JAR # | |
############################################## | |
# Build app | |
- name: Build with Gradle | |
run: ./gradlew assemble | |
- name: Setup build tool version variable | |
shell: bash | |
run: | | |
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) | |
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV | |
echo Last build tool version is: $BUILD_TOOL_VERSION | |
- name: Sign app APK | |
uses: r0adkll/sign-android-release@v1 | |
# ID used to access action output | |
id: sign_app | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGN_APK_SIGNING_KEY }} | |
alias: ${{ secrets.SIGN_APK_ALIAS }} | |
keyStorePassword: ${{ secrets.SIGN_APP_STOREPASS }} | |
keyPassword: ${{ secrets.SIGN_APP_KEYPASS }} | |
env: | |
# override default build-tools version (29.0.3) -- optional | |
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} | |
- name: Push to google play | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_CONSOLE }} | |
packageName: org.glpi.inventory.agent | |
releaseFiles: app/build/outputs/apk/release/app-release-unsigned-signed.apk | |
track: alpha |