Skip to content

Workflow file for this run

on:
release:
types: [published]
permissions:
contents: write
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Get Current Release
id: get_current_release
uses: joutvhu/get-release@v1
with:
debug: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get version tag
id: version
shell: bash
run: echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.4'
- name: Install dependencies
run: flutter pub get
- name: Run code generation
run:
dart run build_runner build --delete-conflicting-outputs
dart run flutter_launcher_icons
- name: Build Windows
run: flutter build windows --release --build-name ${{ steps.version.outputs.version }}
- name: Package assets into a zip file
uses: vimtor/action-zip@v1.2
with:
files: build\windows\x64\runner\Release
dest: balamod-windows.zip
- name: Push exe to release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_current_release.outputs.upload_url }}
asset_path: balamod-windows.zip
asset_name: balamod-windows.zip
asset_content_type: application/zip
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version tag
id: version
run: echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
- name: Get Current Release
id: get_current_release
uses: joutvhu/get-release@v1
with:
debug: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup ninja build tooling
uses: seanmiddleditch/gha-setup-ninja@master
- name: Install GTK3+ development libraries
run: sudo apt-get install -y libgtk-3-dev
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.4'
- name: Install dependencies
run: flutter pub get
- name: Run code generation
run:
dart run build_runner build --delete-conflicting-outputs
dart run flutter_launcher_icons
- name: Build Linux
run: flutter build linux --release --build-name ${{ steps.version.outputs.version }}
- name: Package assets into a tar.gz file
run: tar -czvf balamod-linux.tar.gz build/linux/x64/release/bundle
- name: Push executable to release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_current_release.outputs.upload_url }}
asset_path: balamod-linux.tar.gz
asset_name: balamod-linux.tar.gz
asset_content_type: application/octet-stream
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install the Apple certificate and provisioning profile
env:
DEVELOPER_ID_APPLICATION_CERTIFICATE: ${{ secrets.DEVELOPER_ID_APPLICATION_CERTIFICATE }}
DEVELOPER_ID_INSTALLER_CERTIFICATE: ${{ secrets.DEVELOPER_ID_INSTALLER_CERTIFICATE }}
MACOS_PROVISIONNING_PROFILE: ${{ secrets.MACOS_PROVISIONNING_PROFILE }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
run: |
# create variables
BUILD_CERTIFICATE_PATH=$RUNNER_TEMP/balamod_developer_id_application.p12
INSTALLER_CERTIFICATE_PATH=$RUNNER_TEMP/balamod_developer_id_installer.p12
PP_PATH=$RUNNER_TEMP/balamod_provisionning_profile.provisionprofile
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$DEVELOPER_ID_APPLICATION_CERTIFICATE" | base64 --decode -o $BUILD_CERTIFICATE_PATH
echo -n "$DEVELOPER_ID_INSTALLER_CERTIFICATE" | base64 --decode -o $INSTALLER_CERTIFICATE_PATH
echo -n "$MACOS_PROVISIONNING_PROFILE" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificates to keychain
security import $BUILD_CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import $INSTALLER_CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Get version tag
id: version
run: echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
- name: Get Current Release
id: get_current_release
uses: joutvhu/get-release@v1
with:
debug: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.4'
- name: Install dependencies
run: flutter pub get
- name: Run code generation
run:
dart run build_runner build --delete-conflicting-outputs
dart run flutter_launcher_icons
- name: Build MacOS
run: flutter build macos --release --build-name ${{ steps.version.outputs.version }}
- name: Generate PKG file
run: |
pkgbuild --identifier org.balamod.balamod --install-location /Applications --root build/macos/Build/Products/Release/Balamod.app ./balamod.pkg
- name: Sign installer
run: |
productsign --sign "${{ secrets.DEVELOPER_ID_INSTALLER_NAME }}" ./balamod.pkg ./signed-balamod.pkg
- name: Push pkg to release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_current_release.outputs.upload_url }}
asset_path: signed-balamod.pkg
asset_name: balamod.pkg
asset_content_type: application/octet-stream