Build and Release #128
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 and Release | |
on: | |
workflow_dispatch: | |
inputs: | |
beta: | |
type: boolean | |
description: Is beta? | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '17' | |
- name: Flutter Doctor | |
id: flutter_doctor | |
run: | | |
flutter doctor -v | |
- name: Check submodule | |
id: check_submodule | |
run: | | |
git checkout ${{ inputs.checkout }} | |
- name: Extract Version | |
id: extract_version | |
run: | | |
VERSION=$(grep -oP "^version: [^\+]+" pubspec.yaml | tail -c +10) | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
if [ ${{ inputs.beta }} == true ]; then BETA=true; else BETA=false; fi | |
echo "beta=$BETA" >> $GITHUB_OUTPUT | |
TAG="v$VERSION" | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
- name: Build APKs | |
run: | | |
sed -i 's/signingConfig signingConfigs.release//g' android/app/build.gradle | |
flutter build apk --flavor normal && flutter build apk --split-per-abi --flavor normal | |
for file in build/app/outputs/flutter-apk/app-*normal*.apk*; do mv "$file" "${file//-normal/}"; done | |
flutter build apk --flavor fdroid -t lib/main_fdroid.dart && flutter build apk --split-per-abi --flavor fdroid -t lib/main_fdroid.dart | |
rm ./build/app/outputs/flutter-apk/*.sha1 | |
cp ./sign.sh ./build/app/outputs/flutter-apk/ | |
ls -l ./build/app/outputs/flutter-apk/ | |
- name: Save Unsigned APKs as Action Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: build/app/outputs/flutter-apk/* | |
- name: Create Tag | |
uses: mathieudutour/github-tag-action@v6.1 | |
with: | |
github_token: ${{ secrets.GH_ACCESS_TOKEN }} | |
custom_tag: "${{ steps.extract_version.outputs.tag }}" | |
tag_prefix: "" | |
- name: Create Draft Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GH_ACCESS_TOKEN }} | |
tag: "${{ steps.extract_version.outputs.tag }}" | |
prerelease: "${{ steps.extract_version.outputs.beta }}" | |
draft: "true" | |
generateReleaseNotes: true |