Merge pull request #495 from lyskouski/BF-494 #112
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: Project Release Artifacts | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
release: | |
uses: ./.github/workflows/create_release_page.yml | |
secrets: inherit | |
with: | |
draft: false | |
build: | |
name: Create ${{ matrix.target }} build | |
runs-on: ${{ matrix.os }} | |
needs: release | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [macOS, iOS, Windows, LinuxSnap, Android, Web] | |
include: | |
- os: macos-latest | |
target: macOS | |
build_path: build/macos/Build/Products/Release | |
asset_extension: .zip | |
asset_content_type: application/zip | |
- os: macos-latest | |
target: iOS | |
build_path: build/ios/ipa | |
asset_extension: .ipa | |
asset_content_type: application/zip | |
- os: windows-latest | |
target: Windows | |
build_path: build/windows/x64/runner/Release | |
asset_extension: .zip | |
asset_content_type: application/zip | |
- os: ubuntu-latest | |
target: LinuxSnap | |
build_path: ./ | |
asset_extension: .snap | |
asset_content_type: application/gzip | |
- os: ubuntu-latest | |
target: Android | |
build_path: build/app/outputs/bundle/release/ | |
asset_extension: .aab | |
asset_content_type: application/zip | |
- os: ubuntu-latest | |
target: Web | |
build_path: build/web/ | |
asset_extension: .tar.gz | |
asset_content_type: application/gzip | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- run: flutter pub get | |
- name: Patch PubSpec | |
run: dart run grinder pubspec-update --build-name=${{ needs.release.outputs.version }} --build-number=${{ needs.release.outputs.build_number }} | |
# Web | |
- name: Build Web Package | |
if: matrix.target == 'Web' | |
run: flutter build -v web --release --no-tree-shake-icons --base-href="/app/finance/" | |
- name: Compress Web Package | |
if: matrix.target == 'Web' | |
run: tar czf $GITHUB_WORKSPACE/fingrom_${{ matrix.target }}${{ matrix.asset_extension }} * | |
working-directory: ${{ matrix.build_path }} | |
# Windows | |
- name: Run Windows Build | |
if: matrix.target == 'Windows' | |
run: | | |
flutter config --enable-windows-desktop | |
flutter build -v windows --build-name=${{ needs.release.outputs.version }} --build-number=${{ needs.release.outputs.build_number }} --release --obfuscate --split-debug-info=build/windows/symbols | |
- name: Copy Additional DLLs | |
if: matrix.target == 'Windows' | |
run: | | |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') . | |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') . | |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') . | |
working-directory: ${{ matrix.build_path }} | |
- name: Generate Windows MSIX-package | |
if: matrix.target == 'Windows' | |
run: dart run msix:create --version ${{ needs.release.outputs.version }}.0 --output-path ${{ matrix.build_path }} --output-name Fingrom --build-windows false | |
- name: Compress Windows Package | |
if: matrix.target == 'Windows' | |
run: compress-archive -Path * -DestinationPath ${env:GITHUB_WORKSPACE}/fingrom_${{ matrix.target }}${{ matrix.asset_extension }} | |
working-directory: ${{ matrix.build_path }} | |
- name: Setup MS Store CLI | |
if: matrix.target == 'Windows' | |
uses: microsoft/setup-msstore-cli@ec39acd1144351ab7a9d8d25e12bf6fd1ba03150 | |
- name: Publish MSIX to the Microsoft Store | |
if: matrix.target == 'Windows' | |
run: | | |
msstore reconfigure --tenantId ${{ secrets.WINDOWS_TENANT_ID }} --clientId ${{ secrets.WINDOWS_CLIENT_ID }} --clientSecret ${{ secrets.WINDOWS_SECRET }} --sellerId ${{ secrets.WINDOWS_SELLER_ID }} | |
msstore publish -i ${{ matrix.build_path }} || echo "Publishing failed since replaced build in review state." | |
# Linux Snap | |
- name: Install Snapcraft | |
if: matrix.target == 'LinuxSnap' | |
uses: canonical/[email protected] | |
- name: Build Snap | |
if: matrix.target == 'LinuxSnap' | |
run: | | |
sudo snap install snapcraft --classic | |
snapcraft --verbose | |
cp fingrom_${{ needs.release.outputs.version }}+${{ needs.release.outputs.build_number }}_amd64.snap fingrom_${{ matrix.target }}.snap | |
- name: Publish Snap | |
if: matrix.target == 'LinuxSnap' | |
env: | |
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_CREDENTIALS }} | |
run: | | |
sudo --preserve-env=SNAPCRAFT_STORE_CREDENTIALS snapcraft upload fingrom_${{ matrix.target }}.snap --release=latest/stable | |
# Android | |
- name: Apply Android Keychain | |
if: matrix.target == 'Android' | |
env: | |
ANDROID_JKS: ${{ secrets.ANDROID_JKS }} | |
ANDROID_KEY: ${{ secrets.ANDROID_KEY }} | |
run: | | |
mkdir -p ~/private_keys | |
echo -n "$ANDROID_JKS" | base64 -d > $GITHUB_WORKSPACE/android/app/key.jks | |
echo -n "$ANDROID_KEY" | base64 -d > $GITHUB_WORKSPACE/android/key.properties | |
- name: Run Android Build | |
if: matrix.target == 'Android' | |
run: | | |
flutter build appbundle --build-name=${{ needs.release.outputs.version }} --build-number=${{ needs.release.outputs.build_number }} --release --no-tree-shake-icons --obfuscate --split-debug-info=build/app/symbols | |
mv ${{ matrix.build_path }}/app-release.aab $GITHUB_WORKSPACE/fingrom_${{ matrix.target }}.aab | |
# iOS | |
- name: Import Distribution Certificate | |
if: matrix.target == 'iOS' | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
keychain: signing_distr | |
p12-file-base64: ${{ secrets.APPLE_P12 }} | |
p12-password: ${{ secrets.APPLE_P12_KEY }} | |
# - name: Import Development Certificate | |
# if: matrix.target == 'iOS' | |
# uses: apple-actions/import-codesign-certs@v2 | |
# with: | |
# keychain: signing_dev | |
# p12-file-base64: ${{ secrets.APPLE_DEV_P12 }} | |
# p12-password: ${{ secrets.APPLE_DEV_P12_KEY }} | |
- name: Install the Provisioning Profile | |
if: matrix.target == 'iOS' | |
env: | |
PROVISIONING_CERTIFICATE_BASE64: ${{ secrets.APPLE_IOS_PROFILE }} | |
run: | | |
PP_PATH=$RUNNER_TEMP/Fingrom_iOS.mobileprovision | |
echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode --output $PP_PATH | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | |
- name: Store API key | |
if: matrix.target == 'iOS' || matrix.target == 'macOS' | |
env: | |
API_CERTIFICATE_BASE64: ${{ secrets.APPLE_API_P8 }} | |
run: | | |
mkdir -p ~/private_keys | |
echo -n "$API_CERTIFICATE_BASE64" | base64 --decode --output ~/private_keys/AuthKey_${{ secrets.APPLE_API_KEY }}.p8 | |
- name: Run iOS Build | |
if: matrix.target == 'iOS' | |
run: | | |
flutter build ipa --build-name=${{ needs.release.outputs.version }} --build-number=${{ needs.release.outputs.build_number }} --release --obfuscate --split-debug-info=build/ios/symbols --no-tree-shake-icons --export-options-plist ./ios/ExportOptions.plist | |
mv ${{ matrix.build_path }}/fingrom.ipa fingrom_${{ matrix.target }}.ipa | |
- name: Upload iOS Package to Apple Store | |
if: matrix.target == 'iOS' | |
run: | | |
xcrun altool --validate-app --type ios -f fingrom_${{ matrix.target }}.ipa --apiKey ${{ secrets.APPLE_API_KEY }} --apiIssuer ${{ secrets.APPLE_API_ISSUE }} | |
xcrun altool --upload-app --type ios -f fingrom_${{ matrix.target }}.ipa --apiKey ${{ secrets.APPLE_API_KEY }} --apiIssuer ${{ secrets.APPLE_API_ISSUE }} | |
# macOS | |
- name: Run macOS Build | |
if: matrix.target == 'macOS' | |
run: | | |
flutter config --enable-macos-desktop | |
flutter build -v macos --build-name=${{ needs.release.outputs.version }} --build-number=${{ needs.release.outputs.build_number }} --release --obfuscate --split-debug-info=build/macos/symbols --no-tree-shake-icons | |
- name: Add the Provisioning Profile | |
if: matrix.target == 'macOS' | |
env: | |
PROVISIONING_MAC_BASE64: ${{ secrets.APPLE_MAC_PROFILE }} | |
run: | | |
PP_PATH=$RUNNER_TEMP/Fingrom_macOS.provisionprofile | |
echo -n "$PROVISIONING_MAC_BASE64" | base64 --decode --output $PP_PATH | |
cp $PP_PATH ${{ matrix.build_path }}/Fingrom.app/Contents/embedded.provisionprofile | |
- name: Compress macOS Package | |
if: matrix.target == 'macOS' | |
run: ditto -c -k --sequesterRsrc --keepParent Fingrom.app $GITHUB_WORKSPACE/fingrom_${{ matrix.target }}${{ matrix.asset_extension }} | |
working-directory: ${{ matrix.build_path }} | |
- name: Import macOS Distribution Certificate | |
if: matrix.target == 'macOS' | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
keychain: signing_distr | |
p12-file-base64: ${{ secrets.APPLE_MAC_P12 }} | |
p12-password: ${{ secrets.APPLE_MAC_P12_KEY }} | |
- name: Sign macOS Package | |
if: matrix.target == 'macOS' | |
run: | | |
codesign --deep --force -s "8PVKPQ758L" --entitlements $GITHUB_WORKSPACE/macos/Runner/Release.entitlements "Fingrom.app" | |
working-directory: ${{ matrix.build_path }} | |
- name: Import macOS Installer Certificate | |
if: matrix.target == 'macOS' | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
keychain: signing_installer | |
p12-file-base64: ${{ secrets.APPLE_MAC_INSTALLER }} | |
p12-password: ${{ secrets.APPLE_MAC_P12_KEY }} | |
- name: Create macOS Package for Apple Store | |
if: matrix.target == 'macOS' | |
run: | | |
xcrun productbuild --component Fingrom.app /Applications/ unsigned.pkg | |
xcrun productsign --sign "8PVKPQ758L" unsigned.pkg Fingrom.pkg | |
working-directory: ${{ matrix.build_path }} | |
- name: Upload macOS Package to Apple Store | |
if: matrix.target == 'macOS' | |
run: | | |
xcrun altool --validate-app --type macos -f Fingrom.pkg --apiKey ${{ secrets.APPLE_API_KEY }} --apiIssuer ${{ secrets.APPLE_API_ISSUE }} | |
xcrun altool --upload-app --type macos -f Fingrom.pkg --apiKey ${{ secrets.APPLE_API_KEY }} --apiIssuer ${{ secrets.APPLE_API_ISSUE }} | |
working-directory: ${{ matrix.build_path }} | |
# | |
- name: Upload ${{ matrix.target }} Artifact | |
id: upload_release_asset | |
uses: actions/upload-release-asset@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./fingrom_${{ matrix.target }}${{ matrix.asset_extension }} | |
asset_name: fingrom_${{ matrix.target }}${{ matrix.asset_extension }} | |
asset_content_type: ${{ matrix.asset_content_type }} | |
# Linux | |
build-linux: | |
uses: ./.github/workflows/build_package_linux.yml | |
if: success() | |
needs: | |
- release | |
with: | |
version: ${{ needs.release.outputs.version }} | |
build_number: ${{ needs.release.outputs.build_number }} | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
is_release: true | |
# Linux Flatpak | |
build-flatpak: | |
uses: ./.github/workflows/build_package_flatpak.yml | |
if: success() | |
needs: | |
- release | |
- build-linux | |
secrets: inherit | |
with: | |
version: ${{ needs.release.outputs.version }} | |
sha: ${{ github.sha }} | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
is_release: true | |
# Linux AppImage | |
build-appimage: | |
uses: ./.github/workflows/build_package_appimage.yml | |
if: success() | |
needs: | |
- release | |
- build-linux | |
secrets: inherit | |
with: | |
version: ${{ needs.release.outputs.version }} | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
is_release: true |