Skip to content

FairEmail - github

FairEmail - github #82

Workflow file for this run

# 2024-01-28 21:10
# build-github.yml
name: FairEmail - github
on:
workflow_dispatch:
inputs:
create-archive-all:
description: Create archive with ~ all files
type: boolean
default: false
compileSdkVersion:
description: compileSdkVersion
type: boolean
default: false
skip_sign:
description: skip sign
type: boolean
default: false
env:
PRG_NAME: "FairEmail"
PRG_VERSION: "v1.2080"
PRG_VERSION_suffix: "a"
PRG_FLAVOR: "github"
TAG_NAME: "FairEmail"
TAG_VERSION: "v1.2080"
TAG_BUILD: "-b"
TAG_REF: "0000000"
ANDROID_SIGNING_KEY: '${{ secrets.ANDROID_SIGNING_KEY }}'
# signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
# alias: ${{ secrets.ANDROID_ALIAS }}
# keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
# keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
# BUILD_TOOLS_VERSION: "34.0.0"
# BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOLS_VERSION }}
BUILD_TOOLS_VERSION: "34.0.0"
jobs:
validation:
runs-on: ubuntu-latest
steps:
- uses: deep-soft/checkout@v4
- uses: deep-soft/wrapper-validation-action@v2
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: deep-soft/checkout@v4
- name: Get ref, set build version
continue-on-error: true
shell: bash
run: |
# set -x
_ref_all_=$(git log -1 --format='%H')
# _ref_=$(echo ${_ref_all_::7})
_ref_org_=${{ env.TAG_REF }}
_ref_len_="${#_ref_org_}"
_ref_=$(echo ${_ref_all_::$_ref_len_})
_prg_version_base_="v"$(grep "versionName " "app/build.gradle" | cut -d '"' -f2)
_prg_version_=$_prg_version_base_$(grep "def getVersionCode" "app/build.gradle" | cut -d ' ' -f7)
echo "TAG_REF=$_ref_" >> $GITHUB_ENV
_build_=${{ env.TAG_BUILD }}.$_ref_
echo "TAG_BUILD=$_build_" >> $GITHUB_ENV
echo "PRG_VERSION=$_prg_version_" >> $GITHUB_ENV
echo "TAG_VERSION=$_prg_version_" >> $GITHUB_ENV
- name: Print ref, build version
shell: bash
run: |
echo "NAM: ${{ env.PRG_NAME }}"
echo "VER: ${{ env.PRG_VERSION }}"
echo "TAG: ${{ env.TAG_VERSION }}"
echo "REF: ${{ env.TAG_REF }}"
echo "BLD: ${{ env.TAG_BUILD }}"
echo "${{ env.PRG_NAME }}-src-${{ env.PRG_VERSION }}-${{ env.TAG_BUILD }}" > _tag_name_.txt
- name: compileSdkVersion
if: ${{ inputs.compileSdkVersion }}
shell: bash
run: |
#set -x;
echo "compileSdk ... ";
grep -i "compileSdk" "app/build.gradle" || true;
echo "... done";
sed -ibak 's|compileSdk |compileSdkVersion |' "app/build.gradle";
sed -ibk2 's| dimension "all"| dimension "all"\n compileSdkVersion 34|' "app/build.gradle";
echo "compileSdk ... ";
grep -i "compileSdk" "app/build.gradle" || true;
echo "... done";
ls -la app/
# signingConfig signingConfigs.release
- name: skip sign
if: ${{ inputs.skip_sign }}
shell: bash
run: |
#set -x;
echo "sign ... ";
grep -i "sign" "app/build.gradle" || true;
echo "... done ";
echo "keystore ... ";
grep "keystore" "app/build.gradle" || true;
echo "... done ";
sed -i '/^ signingConfigs {$/,/^ }$/d' "app/build.gradle";
sed -i '/signingConfig signingConfigs.release/d' "app/build.gradle";
sed -i '/^def keystoreProperties = new Properties()$/,/^keystoreProperties.load(new FileInputStream(rootProject.file(\"keystore.properties\")))$/d' "app/build.gradle";
echo "sign ... ";
grep -i "sign" "app/build.gradle" || true;
sleep 2
echo "keystore ... ";
grep "keystore" "app/build.gradle" || true;
echo "... done";
echo " app/build.gradle ... ";
cat "app/build.gradle";
echo " ... app/build.gradle";
# signingConfig signingConfigs.release
- name: skip sign v2
shell: bash
run: |
#set -x;
echo "sign ... ";
grep -i "sign" "app/build.gradle" || true;
echo "... done ";
sed -i '/^ signingConfigs {$/,/^ }$/d' "app/build.gradle";
sed -i 's|signingConfig signingConfigs.release|// signingConfig signingConfigs.release|' "app/build.gradle";
echo "sign ... ";
grep -i "sign" "app/build.gradle" || true;
echo "... done";
echo " app/build.gradle ... ";
cat "app/build.gradle";
echo " ... app/build.gradle";
# zip source begin
- name: Create Archive source
# if: inputs.create-archive-all == true
uses: deep-soft/zip-release@v3
with:
type: 'zip'
filename: '${{ env.TAG_NAME }}-${{ env.TAG_VERSION }}-${{ env.PRG_FLAVOR }}-src.zip'
directory: '.'
path: '.'
exclusions: '*.git* ./*.git/* ./app/schemas/* ./app/schemas/ /*node_modules/* .editorconfig'
env_variable: 'ZIP_RELEASE_SOURCE'
# default archive name is ${{ env.ZIP_RELEASE_ARCHIVE }}
- name: print env value
# if: inputs.create-archive-all == true
shell: bash
run: |
echo "env.ZIP_RELEASE_SOURCE=${{ env.ZIP_RELEASE_SOURCE }}"
echo "env.ZIP_RELEASE_ARCHIVE=${{ env.ZIP_RELEASE_ARCHIVE }}"
- name: Publish source
# if: inputs.create-archive-all == true
continue-on-error: true
uses: deep-soft/action-gh-release@v2.1
with:
draft: true
tag_name: ${{ env.TAG_NAME }}-${{ env.PRG_FLAVOR }}
files: |
${{ env.ASSET_REL }}
${{ env.ZIP_RELEASE_SOURCE }}
# zip source end
- name: Setup java (v4)
uses: deep-soft/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: gradle
- name: gradle build (v3)
uses: deep-soft/gradle-build-action@v3
- name: gradle Assemble github Release
run: ./gradlew assemblegithubRelease
# Search in /usr/local/lib/android/sdk/build-tools/
- name: List android/sdk/build-tools/
shell: bash
run: |
echo "ls -la /usr/local/lib/android/sdk/ || true;"
ls -la /usr/local/lib/android/sdk/ || true;
echo "ls -la /usr/local/lib/android/sdk/build-tools/ || true;"
ls -la /usr/local/lib/android/sdk/build-tools/ || true;
# zip release begin
- name: Create Archive All
if: inputs.create-archive-all == true
uses: deep-soft/zip-release@v3
with:
type: 'zip'
filename: '${{ env.TAG_NAME }}-${{ env.TAG_VERSION }}-${{ env.PRG_FLAVOR }}-all.zip'
directory: '.'
path: '.'
exclusions: '*.git* ./*.git/* ./app/schemas/* ./app/schemas/ /*node_modules/* .editorconfig'
# archive name is ${{ env.ZIP_RELEASE_ARCHIVE }}
- name: print env value
if: inputs.create-archive-all == true
shell: bash
run: |
echo "env.ZIP_RELEASE_ARCHIVE=${{ env.ZIP_RELEASE_ARCHIVE }}"
- name: Publish Release
if: inputs.create-archive-all == true
continue-on-error: true
uses: deep-soft/action-gh-release@v2.1
with:
draft: true
tag_name: ${{ env.TAG_NAME }}-${{ env.PRG_FLAVOR }}
files: |
${{ env.ASSET_REL }}
${{ env.ZIP_RELEASE_ARCHIVE }}
# zip release end
- name: Upload Artifact
uses: deep-soft/upload-artifact@v4
with:
name: upload-artifact
path: |
./app/build/outputs/apk/github/release/
- name: Copy apk from outputs/
shell: bash
run: |
set -x
mkdir -p signed-apk
echo "LIST: " ./app/build/outputs/apk/github/release/
ls -l ./app/build/outputs/apk/github/release/
cp ./app/build/outputs/apk/github/release/*.apk ./signed-apk/ || true;
cp ./app/build/outputs/apk/github/release/*.json ./signed-apk/ || true;
echo "LIST: " ./signed-apk/
ls -l ./signed-apk/ || true;
mv ./signed-apk/${{ env.PRG_NAME }}-${{ env.PRG_VERSION }}*-${{ env.PRG_FLAVOR }}-release-unsigned.apk ./signed-apk/${{ env.PRG_NAME }}-${{ env.PRG_VERSION }}-${{ env.PRG_FLAVOR }}-release.apk
echo "LIST: " ${{ env.PRG_NAME }}-${{ env.PRG_VERSION }}-${{ env.PRG_FLAVOR }}-release.apk
ls -l ./signed-apk/ || true;
- uses: deep-soft/sign-android-release@v1
name: Sign app APK
if: env.ANDROID_SIGNING_KEY != null
id: sign-FairEmail
with:
releaseDirectory: ./signed-apk
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
env:
# override default build-tools version (29.0.3) -- optional
# BUILD_TOOLS_VERSION: "30.0.2"
# BUILD_TOOLS_VERSION: "34.0.5"
BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOLS_VERSION }}
- name: Upload Artifacts
if: env.ANDROID_SIGNING_KEY != null
uses: deep-soft/upload-artifact@v4
with:
name: ${{ env.PRG_NAME }}-${{ env.PRG_VERSION }}-${{ env.PRG_FLAVOR }}-release.apk
path: ${{steps.sign-FairEmail.outputs.signedReleaseFile}}
- name: Publish signed apk package
if: env.ANDROID_SIGNING_KEY != null
uses: deep-soft/action-gh-release@v2.1
with:
draft: true
tag_name: ${{ env.TAG_NAME }}
body: "${{ env.PRG_NAME }} ${{ env.PRG_VERSION }} build:${{ env.TAG_BUILD }}"
files: |
${{steps.sign-FairEmail.outputs.signedReleaseFile}}
_tag_name_.txt
- name: Publish version build - signed apk package
if: env.ANDROID_SIGNING_KEY != null
uses: deep-soft/action-gh-release@v2.1
with:
draft: true
tag_name: ${{ env.TAG_NAME }}-${{ env.TAG_VERSION }}${{ env.TAG_BUILD }}
body: "${{ env.PRG_NAME }} ${{ env.PRG_VERSION }} build:${{ env.TAG_BUILD }}"
files: |
${{steps.sign-FairEmail.outputs.signedReleaseFile}}
_tag_name_.txt
- name: Publish unsigned apk package
if: env.ANDROID_SIGNING_KEY == null
uses: deep-soft/action-gh-release@v2.1
with:
draft: true
tag_name: ${{ env.TAG_NAME }}
files: |
./signed-apk/${{ env.PRG_NAME }}-${{ env.PRG_VERSION }}-${{ env.PRG_FLAVOR }}-unsigned.apk
_tag_name_.txt