Flutter release #33
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: Flutter release | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
env: | |
ANDROID_BUILD_PATH: ${{ vars.ANDROID_BUILD_PATH }} | |
LINUX_BUILD_PATH: ${{ vars.LINUX_BUILD_PATH }} | |
MACOS_BUILD_PATH: ${{ vars.MACOS_BUILD_PATH }} | |
WINDOWS_BUILD_PATH: ${{ vars.WINDOWS_BUILD_PATH }} | |
jobs: | |
release-android-and-linux: | |
runs-on: ubuntu-latest | |
env: | |
LINUX_ZIP: Vernet-${{github.ref_name}}-linux.zip | |
ANDROID_APK_ARM_V7A: app-armeabi-v7a-dev-release.apk | |
ANDROID_APK_ARM_V8A: app-arm64-v8a-dev-release.apk | |
ANDROID_APK_x86_64: app-x86_64-dev-release.apk | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# setup java because we are building for android too | |
- name: Setup Java JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: '17' | |
- name: Flutter action | |
uses: subosito/[email protected] | |
with: | |
channel: stable | |
- name: Download pub dependencies | |
run: flutter pub get | |
- name: Upgrade pub dependencies | |
run: flutter pub upgrade | |
- name: Run build_runner | |
run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: Download Android keystore | |
id: android_keystore | |
uses: timheuer/[email protected] | |
with: | |
fileName: key.jks | |
encodedString: '${{ secrets.ANDROID_KEYSTORE_BASE64 }}' | |
- name: Create key.properties | |
run: | | |
echo "storeFile=${{ steps.android_keystore.outputs.filePath }}" >> android/key.properties | |
echo "storePassword=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" >> android/key.properties | |
echo "keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> android/key.properties | |
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties | |
- name: Create artifacts directory | |
run: mkdir -p artifacts | |
- name: Install dependencies | |
run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev | |
- name: Build Android App and Linux Bundle | |
# Use signing keys for release instead of debug | |
run: | | |
flutter build apk --split-per-abi --flavor dev | |
flutter build linux --release | |
- name: Rename ANDROID APKs | |
run: | | |
mv ${{vars.ANDROID_BUILD_PATH}}/${{env.ANDROID_APK_ARM_V7A}} ${{vars.ANDROID_BUILD_PATH}}/Vernet-${{github.ref_name}}-${{env.ANDROID_APK_ARM_V7A}} | |
mv ${{vars.ANDROID_BUILD_PATH}}/${{env.ANDROID_APK_ARM_V8A}} ${{vars.ANDROID_BUILD_PATH}}/Vernet-${{github.ref_name}}-${{env.ANDROID_APK_ARM_V8A}} | |
mv ${{vars.ANDROID_BUILD_PATH}}/${{env.ANDROID_APK_x86_64}} ${{vars.ANDROID_BUILD_PATH}}/Vernet-${{github.ref_name}}-${{env.ANDROID_APK_x86_64}} | |
- name: Linux Archive | |
uses: thedoctor0/zip-release@master | |
with: | |
type: 'zip' | |
filename: ${{ env.LINUX_ZIP }} | |
directory: ${{ vars.LINUX_BUILD_PATH }} | |
- name: Publish Android Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
${{vars.ANDROID_BUILD_PATH}}/Vernet-${{github.ref_name}}-${{env.ANDROID_APK_ARM_V7A}} | |
${{vars.ANDROID_BUILD_PATH}}/Vernet-${{github.ref_name}}-${{env.ANDROID_APK_ARM_V8A}} | |
${{vars.ANDROID_BUILD_PATH}}/Vernet-${{github.ref_name}}-${{env.ANDROID_APK_x86_64}} | |
- name: Publish Linux Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: ${{ vars.LINUX_BUILD_PATH }}/${{ env.LINUX_ZIP }} | |
- name: Build Android App Bundle | |
run: flutter build appbundle --flavor store | |
- name: 'Setup Ruby, JRuby and TruffleRuby' | |
uses: ruby/[email protected] | |
with: | |
ruby-version: 3.1.2 | |
- name: Cache bundle dependencies | |
uses: actions/cache@v2 | |
with: | |
path: android/vendor/bundle | |
key: '${{ runner.os }}-gems-${{ hashFiles(''**/Gemfile.lock'') }}' | |
restore-keys: '${{ runner.os }}-gems-' | |
- name: Download bundle dependencies | |
working-directory: android/ | |
run: | | |
gem install bundler:2.3.20 | |
bundle config path vendor/bundle | |
bundle install | |
- name: Release to Google Play | |
env: | |
SUPPLY_PACKAGE_NAME: '${{ secrets.ANDROID_PACKAGE_NAME }}' | |
SUPPLY_JSON_KEY_DATA: '${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}' | |
working-directory: android/ | |
run: bundle exec fastlane android deploy | |
release-macos: | |
runs-on: macos-latest | |
env: | |
MACOS_ZIP: Vernet-${{github.ref_name}}-macos.zip | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Flutter action | |
uses: subosito/[email protected] | |
with: | |
channel: stable | |
- name: Download pub dependencies | |
run: flutter pub get | |
- name: Upgrade pub dependencies | |
run: flutter pub upgrade | |
- name: Run build_runner | |
run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: Build macos release | |
run: flutter build macos --release | |
- name: Archive macos | |
uses: thedoctor0/zip-release@master | |
with: | |
type: 'zip' | |
filename: ${{ env.MACOS_ZIP }} | |
directory: ${{ vars.MACOS_BUILD_PATH }} | |
path: vernet.app | |
- name: Publish macOS Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: ${{ vars.MACOS_BUILD_PATH }}/${{ env.MACOS_ZIP }} | |
release-windows: | |
runs-on: windows-latest | |
env: | |
WINDOWS_ZIP: Vernet-${{github.ref_name}}-windows.zip | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Flutter action | |
uses: subosito/[email protected] | |
with: | |
channel: stable | |
- name: Download pub dependencies | |
run: flutter pub get | |
- name: Upgrade pub dependencies | |
run: flutter pub upgrade | |
- name: Run build_runner | |
run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: Build windows release | |
run: flutter build windows --release | |
- name: Archive windows Release | |
uses: thedoctor0/zip-release@master | |
with: | |
type: 'zip' | |
filename: ${{ env.WINDOWS_ZIP }} | |
directory: ${{ vars.WINDOWS_BUILD_PATH }} | |
path: vernet.exe | |
- name: Publish Windows Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: ${{ vars.WINDOWS_BUILD_PATH }}/${{ env.WINDOWS_ZIP }} |