Build release #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build apk release | |
on: | |
workflow_dispatch: | |
jobs: | |
build-apk: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'oracle' | |
java-version: '17' | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
- name: Downloading keystores | |
uses: actions/checkout@v4 | |
with: | |
repository: hedon-haven/keystores | |
path: ./android/keystores | |
token: ${{ secrets.READ_ACCESS }} | |
- name: Getting flutter dependencies | |
run: flutter pub get | |
- name: Building split apks | |
run: flutter build apk --split-per-abi | |
- name: Building combined apk | |
run: flutter build apk | |
- name: Copying apks to release dir | |
run: | | |
mkdir ./release | |
mv ./build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ./release/arm32.apk | |
mv ./build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ./release/arm64.apk | |
mv ./build/app/outputs/flutter-apk/app-x86_64-release.apk ./release/x86_64.apk | |
mv ./build/app/outputs/flutter-apk/app-release.apk ./release/all.apk | |
- name: Generating checksums.json | |
run: | | |
json="{}" | |
for file in ./release/*; do | |
checksum=$(sha256sum "$file" | awk '{ print $1 }') | |
# Get the filename without the path | |
filename=$(basename "$file") | |
json=$(echo "$json" | jq --arg file "$filename" --arg checksum "$checksum" '. + {($file): $checksum}') | |
done | |
echo "$json" > ./release/checksums.json | |
- name: Generating release tag | |
id: tag | |
run: | | |
tag=v$(grep -oP '(?<=version: ).*' ./pubspec.yaml) | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
- name: Publishing new release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: APK BUILD - ${{ steps.tag.outputs.tag }} | |
tag_name: ${{ steps.tag.outputs.tag }} | |
make_latest: false | |
prerelease: true | |
files: | | |
./release/*.apk | |
./release/checksums.json |