Initial QSfera import
This commit is contained in:
+112
@@ -0,0 +1,112 @@
|
||||
name: Build unsigned QSfera APK
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build_flavor:
|
||||
description: "Flavor to build"
|
||||
type: choice
|
||||
required: true
|
||||
default: "qa"
|
||||
options:
|
||||
- qa
|
||||
build_type:
|
||||
description: "Type to build"
|
||||
type: choice
|
||||
required: true
|
||||
default: "Debug" # uppercase for Gradle build type
|
||||
options:
|
||||
- Debug
|
||||
version:
|
||||
description: "Version to build (commit, branch or tag)"
|
||||
type: string
|
||||
default: "main"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build_apk:
|
||||
name: Build unsigned QSfera APK
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
artifact_name: ${{ steps.set_artifact.outputs.artifact_name }}
|
||||
commit_hash: ${{ steps.commit.outputs.commit_hash }}
|
||||
|
||||
steps:
|
||||
- name: Checkout current repo
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.version }}
|
||||
|
||||
- name: Get commit hash
|
||||
id: commit
|
||||
run: |
|
||||
COMMIT_HASH=$(git rev-parse HEAD)
|
||||
echo "Commit hash: $COMMIT_HASH"
|
||||
echo "commit_hash=$COMMIT_HASH" >> $GITHUB_OUTPUT
|
||||
echo "commit_hash=$COMMIT_HASH" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Build APK
|
||||
run: |
|
||||
FLAVOR="${{ inputs.build_flavor }}"
|
||||
BUILD_TYPE="${{ inputs.build_type }}"
|
||||
FLAVOR_TASK="$(tr '[:lower:]' '[:upper:]' <<< "${FLAVOR:0:1}")${FLAVOR:1}"
|
||||
./gradlew clean assemble${FLAVOR_TASK}${BUILD_TYPE} -PversionCode=${{ github.run_number }}
|
||||
|
||||
- name: Set artifact name
|
||||
id: set_artifact
|
||||
run: |
|
||||
DATE=$(date +%Y%m%d_%H%M)
|
||||
COMMIT=$(git rev-parse --short HEAD)
|
||||
FLAVOR="${{ inputs.build_flavor }}"
|
||||
BUILD_TYPE="$(echo "${{ inputs.build_type }}" | tr '[:upper:]' '[:lower:]')"
|
||||
NAME="QSfera-${FLAVOR}-${COMMIT}-${DATE}-${GITHUB_RUN_NUMBER}.apk"
|
||||
|
||||
APK_PATH=$(find ./qsferaApp/build/outputs/apk/$FLAVOR/$BUILD_TYPE/ -name "*.apk" -print -quit)
|
||||
|
||||
echo "$APK_PATH"
|
||||
if [ -z "$APK_PATH" ]; then
|
||||
echo "APK not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp "$APK_PATH" "./$NAME"
|
||||
echo "$NAME"
|
||||
|
||||
# Publish as output
|
||||
echo "artifact_name=$NAME" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.set_artifact.outputs.artifact_name }}
|
||||
path: ./${{ steps.set_artifact.outputs.artifact_name }}
|
||||
compression-level: 0
|
||||
|
||||
- name: Upload APK to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: build-tester-apk-${{ github.run_number }}
|
||||
target_commitish: ${{ env.commit_hash }}
|
||||
name: build-tester-apk build ${{ github.run_number }}
|
||||
files: ${{ steps.set_artifact.outputs.artifact_name }}
|
||||
prerelease: true
|
||||
generate_release_notes: false
|
||||
body: Built from ${{ env.commit_hash }}
|
||||
Reference in New Issue
Block a user