Skip to content

Commit

Permalink
misc: clean up workflow, fix create draft release step
Browse files Browse the repository at this point in the history
  • Loading branch information
hjiangsu committed Jan 7, 2025
1 parent d99dee7 commit eccc91d
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release
name: release - android

on:
push:
Expand All @@ -8,9 +8,9 @@ on:
- feat/build-workflow
workflow_dispatch:
inputs:
test_run:
dry_run:
type: boolean
description: Is this a test run?
description: Is this a dry run (do not generate draft release)?
default: true

jobs:
Expand All @@ -27,19 +27,20 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.27.x'
flutter-version: '3.27.x' # When updating this, also update the corresponding f-droid metadata file
channel: 'stable'
cache: true

- name: Extract app version
id: extract_version
- name: Read pubspec.yaml version
id: extract-version
uses: NiklasLehnfeld/flutter-version-number-action@main
with:
file-path: pubspec.yaml

- name: Report build information
- name: Generate version information
id: generate-version-info
run: |
VERSION=${{ steps.extract_version.outputs.version-number }}
VERSION=${{ steps.extract-version.outputs.version-number }}
VERSION=$(echo "$VERSION" | cut -d '+' -f 1)
echo "version=$VERSION" >> $GITHUB_OUTPUT
PRERELEASE=false
Expand All @@ -49,9 +50,9 @@ jobs:
echo "prerelease=$PRERELEASE" >> $GITHUB_OUTPUT
TAG="$VERSION"
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "version=$VERSION | tag=${TAG} | prerelease=$PRERELEASE"
echo "Info: version=$VERSION | tag=${TAG} | prerelease=$PRERELEASE"
- name: Build Android release
- name: Build Android APK (unsigned)
run: |
sed -i 's/signingConfig signingConfigs.release//g' android/app/build.gradle
flutter build apk --release --flavor production --no-tree-shake-icons
Expand All @@ -68,24 +69,22 @@ jobs:
unsignedFn=${apk/-release/-unsigned}
mv "$apk" "$unsignedFn"
${ANDROID_HOME}/build-tools/$(ls ${ANDROID_HOME}/build-tools/ | tail -1)/apksigner sign --ks apksign.keystore --ks-pass pass:"${KEYSTORE_PASSWORD}" --out "${apk}" "${unsignedFn}"
shasum -a 256 ${apk} | cut -d " " -f 1 > "$apk".sha256
${ANDROID_HOME}/build-tools/$(ls ${ANDROID_HOME}/build-tools/ | tail -1)/apksigner verify --print-certs ${apk} 2>/dev/null \ | sed -n 's/^Signer #1 certificate SHA-256 digest: \(.*\)/\1/p'
echo "${apk} | $(shasum -a 256 ${apk} | cut -d " " -f 1)"
done
rm apksign.keystore
echo "Finished signing Android APKs"
- uses: actions/upload-artifact@v4
with:
path: ./build/app/outputs/flutter-apk/app-production-release.apk
path: ./build/app/outputs/flutter-apk/

# - name: Create release and upload artifacts
# if: ${{ inputs.test_run }} == 'false'
# uses: ncipollo/release-action@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# tag: "${{ steps.extract_version.outputs.tag }}"
# prerelease: ${{ steps.extract_version.outputs.prerelease }}
# draft: true
# artifacts: ./build/app/outputs/flutter-apk/*-release*.apk* ./build/app/outputs/flutter-apk/*-debug.apk*
# generateReleaseNotes: true
- name: Create draft release and upload artifacts
if: ${{ inputs.dry_run }} == 'false'
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: "${{ steps.generate-version-info.outputs.tag }}"
prerelease: ${{ steps.generate-version-info.outputs.prerelease }}
draft: true
artifacts: ./build/app/outputs/flutter-apk/*-release*.apk* ./build/app/outputs/flutter-apk/*-debug.apk*
generateReleaseNotes: true

0 comments on commit eccc91d

Please sign in to comment.