Skip to content

release

release #26

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
release_type:
type: choice
description: Type of release
required: true
options:
- major
- minor
- patch
jobs:
authenticate:
name: Validate release request
runs-on: ubuntu-22.04
steps:
- name: Validate Branch
if: github.ref != 'refs/heads/master'
run: |
echo "Can only release on master branch!"
exit 1
- name: Validate actor
run: |
if [[ ",${{ vars.RELEASE_ACTORS }}," != *",${{ github.triggering_actor }},"* ]]; then echo "User ${{ github.triggering_actor }} does not have permission to create a release :/"; exit 1; fi
version-update:
name: Update Version
runs-on: ubuntu-22.04
needs:
- authenticate
outputs:
tag: ${{ steps.update-version.outputs.tag }}
steps:
- uses: actions/checkout@v3
- name: Bump up version
id: update-version
run: |
chmod +x .github/scripts/update_version.sh
version=`./.github/scripts/update_version.sh ${{ github.event.inputs.release_type }}`
echo "tag=$version" >> "$GITHUB_OUTPUT"
- name: Save updated version
uses: EndBug/add-and-commit@v9
with:
add: 'pubspec.yaml'
default_author: user_info
commit: --signoff
fetch: false
message: 'Update version for ${{ github.event.inputs.release_type }} release'
build:
name: Build
runs-on: ubuntu-22.04
needs:
- authenticate
- version-update
env:
ndk-version: r25c
steps:
- uses: actions/checkout@v3
- name: Get Ecosystem core
id: get-ecosystem-core
run: |
git clone https://github.com/sayansil/Ecosystem
cd Ecosystem
commit_hash=$(git rev-parse --short HEAD)
echo "commit_hash=$commit_hash" >> "$GITHUB_OUTPUT"
- name: Restore Ecosystem cache
uses: actions/cache/restore@v3
id: cache-restore
with:
path: native_simulator/android/src/main/jniLibs
key: cache-${{ env.ndk-version }}-${{ steps.get-ecosystem-core.outputs.commit_hash }}
- name: Create binary dirs
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: |
mkdir -p native_simulator/android/src/main/jniLibs/arm64-v8a
mkdir -p native_simulator/android/src/main/jniLibs/armeabi-v7a
- name: Get NDK
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: ${{ env.ndk-version }}
add-to-path: true
- name: Use NDK binaries
if: ${{ !steps.cache-restore.outputs.cache-hit }}
env:
NDK: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
cp $NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so native_simulator/android/src/main/jniLibs/arm64-v8a/libc++_shared.so
cp $NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so native_simulator/android/src/main/jniLibs/armeabi-v7a/libc++_shared.so
- name: Build Ecosystem core
if: ${{ !steps.cache-restore.outputs.cache-hit }}
env:
NDK: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
cd Ecosystem/simulation
sudo apt install ninja-build
cmake --preset and-arm64v8a
cmake --build --preset and-arm64v8a
cmake --preset and-armeabiv7a-neon
cmake --build --preset and-armeabiv7a-neon
- name: Use Ecosystem binaries
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: |
cp Ecosystem/simulation/build/and-arm64v8a/src/libecosystem_wrapper.so native_simulator/android/src/main/jniLibs/arm64-v8a/
cp Ecosystem/simulation/build/and-armeabiv7a-neon/src/libecosystem_wrapper.so native_simulator/android/src/main/jniLibs/armeabi-v7a/
- name: Save Ecosystem cache
uses: actions/cache/save@v3
if: ${{ !steps.cache-restore.outputs.cache-hit }}
id: cache-save
with:
path: native_simulator/android/src/main/jniLibs
key: cache-${{ env.ndk-version }}-${{ steps.get-ecosystem-core.outputs.commit_hash }}
- name: Get flutter
uses: subosito/[email protected]
with:
flutter-version: '3.13.3'
channel: 'stable'
- name: Generate KeyStore
id: generate-keystore
uses: timheuer/[email protected]
with:
fileName: 'android_keystore'
encodedString: ${{ secrets.KEYSTORE }}
- name: Generate key properties
run: |
cd android
mkdir -p app/keystore
cp ${{ steps.generate-keystore.outputs.filePath }} app/keystore/android_keystore
touch key.properties
echo "storePassword=${{ secrets.SIGNING_STORE_PASSWORD }}" >> key.properties
echo "keyPassword=${{ secrets.SIGNING_KEY_PASSWORD }}" >> key.properties
echo "keyAlias=${{ secrets.SIGNING_KEY_ALIAS }}" >> key.properties
echo "storeFile=keystore/android_keystore" >> key.properties
- name: Build release apk
run: |
flutter build apk --release
flutter build appbundle --release
- name: Clean KeyStore
run: |
rm -rf keystore
rm -rf android/key.properties
- name: Get apk
run: |
cp build/app/outputs/flutter-apk/app-release.apk ecosystem-companion-universal.apk
cp build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ecosystem-companion-arm64-v8a.apk
cp build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ecosystem-companion-armeabi-v7a.apk
cp build/app/outputs/bundle/release/app-release.aab ecosystem-companion-appbundle.aab
- name: Draft Release
id: draft-release
uses: softprops/action-gh-release@v1
with:
name: "Release ${{ needs.version-update.outputs.tag }}"
tag_name: ${{ needs.version-update.outputs.tag }}
generate_release_notes: true
files: |
ecosystem-companion-universal.apk
ecosystem-companion-arm64-v8a.apk
ecosystem-companion-armeabi-v7a.apk
ecosystem-companion-appbundle.aab