Skip to content

Updated Android build number #21

Updated Android build number

Updated Android build number #21

name: BuildReleaseApk
on:
push:
tags:
- 'v*' # This triggers the workflow on any tag starting with 'v'
jobs:
buildReleaseApk:
runs-on: macos-latest
permissions:
contents: write
actions: read
steps:
- name: Checkout project
uses: actions/checkout@v3
with:
fetch-depth: "0"
- name: Specify node version
uses: actions/setup-node@v4
with:
node-version: 20
- name: Use npm caches
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Use specific Java version for sdkmanager to work
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Install node_modules
run: npm install --production
- name: Extract Version Name
id: version_name
run: |
VERSION_NAME=$(grep versionName android/app/build.gradle | awk '{print $2}' | tr -d '"')
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
echo "::set-output name=version_name::$VERSION_NAME"
- name: Generate Build Number based on timestamp
run: |
NEW_BUILD_NUMBER=$(date +%s)
echo "NEW_BUILD_NUMBER=$NEW_BUILD_NUMBER" >> $GITHUB_ENV
echo "::set-output name=build_number::$NEW_BUILD_NUMBER"
- name: Build
env:
KEYSTORE_FILE_HEX: ${{ secrets.KEYSTORE_FILE_HEX }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
BUILD_NUMBER: ${{ env.NEW_BUILD_NUMBER }}
run: ./scripts/build-release-apk.sh
- name: Upload APK artifact
uses: actions/upload-artifact@v4
if: success()
with:
name: DFX-Btc-Wallet-${{ env.VERSION_NAME }}(${{ env.NEW_BUILD_NUMBER }}).apk
path: ./android/app/build/outputs/apk/release/app-release.apk
if-no-files-found: error
- uses: cardinalby/git-get-release-action@v1
id: get_release
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag: ${{ github.ref_name }}
- name: Upload artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./android/app/build/outputs/apk/release/app-release.apk
asset_name: DFX-Btc-Wallet-${{ github.ref_name }}.apk
asset_content_type: application/vnd.android.package-archive
- name: Upload artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./android/app/build/outputs/apk/release/app-release.apk.idsig
asset_name: DFX-Btc-Wallet-${{ github.ref_name }}.apk.idsig
asset_content_type: application/octet-stream
- name: Upload artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./android/app/build/outputs/bundle/release/app-release.aab
asset_name: DFX-Btc-Wallet-${{ github.ref_name }}.aab
asset_content_type: application/octet-stream