misc: switch to ubuntu runner #16
Workflow file for this run
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: release | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
branches: | |
- feat/build-workflow | |
workflow_dispatch: | |
inputs: | |
test_run: | |
type: boolean | |
description: Is this a test run? | |
default: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.27.x' | |
channel: 'stable' | |
cache: true | |
- name: Extract app version | |
id: extract_version | |
uses: NiklasLehnfeld/flutter-version-number-action@main | |
with: | |
file-path: pubspec.yaml | |
- name: Report build information | |
run: | | |
VERSION=${{ steps.extract_version.outputs.version-number }} | |
VERSION=$(echo "$VERSION" | cut -d '+' -f 1) | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
PRERELEASE=false | |
if [[ "$VERSION" == *-* ]]; then | |
PRERELEASE=true | |
fi | |
echo "prerelease=$PRERELEASE" >> $GITHUB_OUTPUT | |
TAG="$VERSION" | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
echo "version=$VERSION | tag=${TAG} | prerelease=$PRERELEASE" | |
- name: Build Android release | |
run: | | |
sed -i '' 's/signingConfig signingConfigs.release//g' android/app/build.gradle | |
flutter build apk --release --flavor production --no-tree-shake-icons | |
rm ./build/app/outputs/flutter-apk/*.sha1 | |
ls -l ./build/app/outputs/flutter-apk/ | |
- name: Sign Android APKs | |
env: | |
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
run: | | |
echo "${KEYSTORE_BASE64}" | base64 -d > apksign.keystore | |
for apk in ./build/app/outputs/flutter-apk/*-release*.apk; do | |
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/ | |
# - 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 |