Skip to content

Release apk Signing

Release apk Signing #9

Workflow file for this run

run-name: Release apk Signing
on:
push:
branches:
- 'main'
permissions:
contents: write
jobs:
release-signing-build:
if: contains(github.event.head_commit.message, 'apk') || contains(github.event.head_commit.message, 'all')
name: Release Signing Build
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: Extract Version Code and Version Number
id: extract_version
run: |
# Extract versionCode and versionNumber from commit message
versionCode=$(echo "${{ github.event.head_commit.message }}" | grep -oP '(?<=versionCode=)\d+')
versionNumber=$(echo "${{ github.event.head_commit.message }}" | grep -oP '(?<=versionNumber=)[^\s]+')
echo "VERSION_CODE=$versionCode" >> $GITHUB_ENV
echo "VERSION_NUMBER=$versionNumber" >> $GITHUB_ENV
- name: Update Version in pubspec.yaml
run: |
# Replace the version line with the extracted VERSION_NUMBER and VERSION_CODE
sed -i "s/^version:.*/version: ${VERSION_NUMBER}+${VERSION_CODE}/" pubspec.yaml
grep version: -ri pubspec.yaml
- name: Configure Keystore
run: |
echo "$STOREFILE" | base64 --decode > android/app/upload-keystore.jks
echo "storeFile=upload-keystore.jks" >> android/app/key.properties
echo "keyAlias=$KEYALIAS" >> android/app/key.properties
echo "storePassword=$STOREPASSWORD" >> android/app/key.properties
echo "keyPassword=$KEYPASSWORD" >> android/app/key.properties
env:
STOREFILE: ${{ secrets.STOREFILE }}
KEYALIAS: ${{ secrets.KEYALIAS }}
KEYPASSWORD: ${{ secrets.KEYPASSWORD }}
STOREPASSWORD: ${{ secrets.STOREPASSWORD }}
- name: Install GTK and Ninja
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev ninja-build
- uses: gradle/gradle-build-action@v2
- uses: subosito/flutter-action@v1
with:
channel: stable
flutter-version: 3.24
cache: true
- name: Setup JDK 19
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'temurin'
cache: gradle
# - name: Setup Android SDK
# uses: android-actions/setup-android@v3
- name: Sign and Build Release Bundle
run: |
flutter pub get
flutter build apk --release
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: false
haskell: true
large-packages: false
docker-images: false
swap-storage: true
- name: Upload artefato
uses: actions/upload-artifact@v2
with:
name: appapk
path: build/app/outputs/flutter-apk/app-release.apk