Release Draft #223
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 Draft | |
on: | |
workflow_dispatch: | |
env: | |
FLUTTER_VERSION: "3.24.0" | |
APK_BUILD_DIR: "/tmp/build" | |
ACTIONS_RUNNER_DEBUG: true | |
ACTIONS_STEP_DEBUG: true | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
outputs: | |
version: ${{ steps.get_version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get version from pubspec.yaml | |
id: get_version | |
run: | | |
VERSION=$(sed -n 's/^version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' pubspec.yaml) | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
# set_release_info: | |
# runs-on: ubuntu-latest | |
# outputs: | |
# upload_url: ${{ steps.get_upload_url.outputs.upload_url }} | |
# steps: | |
# - name: Get release | |
# id: get_release | |
# uses: bruceadams/get-release@v1.3.2 | |
# env: | |
# GITHUB_TOKEN: ${{ github.token }} | |
# with: | |
# tag: ${{ needs.build.outputs.version }} | |
# - name: Get upload URL | |
# id: get_upload_url | |
# run: | | |
# upload_url=${{steps.get_release.outputs.upload_url}} | |
# echo "upload_url=$upload_url" >> $GITHUB_OUTPUT | |
# Step 2: Create a GitHub release | |
create_release: | |
needs: build | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.create_release.outputs.id }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ needs.build.outputs.version }}" | |
release_name: "v${{ needs.build.outputs.version }}" | |
draft: true | |
prerelease: false | |
# build_apk: | |
# needs: [build, create_release] | |
# runs-on: ubuntu-22.04 | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# - name: Remove proprietary dependencies | |
# run: sh scripts/remove_proprietary_dependencies.sh | |
# - name: Copy files to env.APK_BUILD_DIR | |
# run: | | |
# mkdir -p $APK_BUILD_DIR | |
# cp -r . $APK_BUILD_DIR | |
# - name: Decode key.properties file | |
# working-directory: ${{ env.APK_BUILD_DIR }} | |
# env: | |
# ENCODED_STRING: ${{ secrets.ANDROID_KEY_PROPERTIES }} | |
# run: echo $ENCODED_STRING | base64 -di > android/key.properties | |
# - name: Decode android-keystore.jks file | |
# working-directory: ${{ env.APK_BUILD_DIR }} | |
# env: | |
# ENCODED_STRING: ${{ secrets.ANDROID_KEY_STORE }} | |
# run: mkdir secrets && echo $ENCODED_STRING | base64 -di > secrets/android-keystore.jks | |
# - name: Set up JDK 17 | |
# uses: actions/setup-java@v4 | |
# with: | |
# distribution: 'temurin' | |
# java-version: '17' | |
# - name: Install Flutter | |
# uses: subosito/flutter-action@v2 | |
# with: | |
# flutter-version: ${{ env.FLUTTER_VERSION }} | |
# - name: Dependencies | |
# working-directory: ${{ env.APK_BUILD_DIR }}/ | |
# run: flutter pub get | |
# - name: Build APK | |
# working-directory: ${{ env.APK_BUILD_DIR }}/ | |
# run: flutter build apk --split-per-abi | |
# - name: Upload APK | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: apk-result | |
# path: | | |
# ${{ env.APK_BUILD_DIR }}/build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
# ${{ env.APK_BUILD_DIR }}/build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
# ${{ env.APK_BUILD_DIR }}/build/app/outputs/flutter-apk/app-x86_64-release.apk | |
build_tar_x86_64: | |
needs: [build, create_release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: "stable" | |
- name: Dependencies | |
working-directory: ./ | |
run: flutter pub get | |
- name: List project files | |
run: ls -R | |
- name: Print working directory | |
run: pwd | |
- name: Clean build | |
run: flutter clean | |
- name: Build locales | |
run: flutter gen-l10n | |
- name: Compile linux | |
working-directory: ./ | |
run: flutter build linux --release --verbose | |
- name: Copy flathub needed files | |
run: | | |
cp lol.janjic.Splitcat.appdata.xml ./build/linux/x64/release/bundle/ | |
cp lol.janjic.Splitcat.desktop ./build/linux/x64/release/bundle/ | |
- name: List files even if the build fails | |
if: always() | |
run: | | |
echo "Listing build directory contents:" | |
ls -R ./build/linux/x64/release/bundle/ || echo "Directory does not exist!" | |
- name: Create tar.gz archive | |
run: | | |
cd ./build/linux/x64/release/bundle | |
tar -czvf ../../../../../result.tar.gz * | |
- name: Upload tar.gz archive | |
id: upload_tar_64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: splitcat-linux-x64 | |
path: ./*.tar.gz | |
- name: Find tar.gz file | |
id: find_targz | |
run: | | |
TARGZ_PATH=$(find ./ -name "*.tar.gz") | |
echo "targz_path=$TARGZ_PATH" >> $GITHUB_OUTPUT | |
- name: Echo targz path | |
run: echo ${{ steps.find_targz.outputs.targz_path }} | |
- name: Upload tar.gz to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.find_targz.outputs.targz_path }} | |
asset_name: splitcat-linux-x64.tar.gz | |
asset_content_type: application/gzip | |
build_deb_x86_64: | |
needs: [build, create_release] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
id: deb_release | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: "stable" | |
- name: Enable dart_distributor | |
run: dart pub global activate flutter_distributor | |
- name: Update PATH | |
run: echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> ~/.bashrc | |
- name: Build locales | |
run: flutter gen-l10n | |
- name: Build deb package | |
working-directory: ./ | |
run: flutter_distributor package --platform linux --targets deb --flutter-build-args=verbose | |
- name: List files in dist | |
run: ls -la dist | |
- name: Test version | |
run: echo ${{ needs.build.outputs.version }} | |
- name: Find deb file | |
id: find_deb | |
run: | | |
VERSION=${{ needs.build.outputs.version }} | |
DEB_PATH=$(find dist -name "splitcat-$VERSION*-linux.deb") | |
echo "deb_path=$DEB_PATH" >> $GITHUB_OUTPUT | |
- name: Check if deb file exists | |
id: check_file | |
run: | | |
if [[ ! -f "${{ steps.find_deb.outputs.deb_path }}" ]]; then | |
echo "File not found: ${{ steps.find_deb.outputs.deb_path }}" | |
exit 1 | |
fi | |
- name: Upload deb file | |
uses: actions/upload-artifact@v4 | |
id: upload_deb | |
with: | |
name: deb-x86-64-result | |
path: ${{ steps.find_deb.outputs.deb_path }} | |
# Upload DEB file to release | |
- name: Upload DEB to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.find_deb.outputs.deb_path }} | |
asset_name: splitcat-linux-x64.deb | |
asset_content_type: application/x-debian-package | |
build_appimage_x86_64: | |
needs: [build, create_release] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev libfuse2 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
channel: "stable" | |
- name: Dependencies | |
working-directory: ./ | |
run: flutter pub get | |
- name: Build locales | |
run: flutter gen-l10n | |
- name: Compile linux | |
working-directory: ./ | |
run: flutter build linux --release | |
- name: Copy compiled linux files | |
run: | | |
mkdir AppDir | |
cp -r build/linux/x64/release/bundle/* AppDir/ | |
- name: Print working directory | |
run: pwd | |
- name: Copy logo to AppDir | |
run: | | |
mkdir -p AppDir/usr/share/icons/hicolor/16x16/apps | |
cp /home/runner/work/splitcat/splitcat/linux/flutter/assets/icons/16x16/icon.png AppDir/usr/share/icons/hicolor/16x16/apps/splitcat.png | |
mkdir -p AppDir/usr/share/icons/hicolor/32x32/apps | |
cp /home/runner/work/splitcat/splitcat/linux/flutter/assets/icons/32x32/icon.png AppDir/usr/share/icons/hicolor/32x32/apps/splitcat.png | |
mkdir -p AppDir/usr/share/icons/hicolor/64x64/apps | |
cp /home/runner/work/splitcat/splitcat/linux/flutter/assets/icons/64x64/icon.png AppDir/usr/share/icons/hicolor/64x64/apps/splitcat.png | |
mkdir -p AppDir/usr/share/icons/hicolor/128x128/apps | |
cp /home/runner/work/splitcat/splitcat/linux/flutter/assets/icons/128x128/icon.png AppDir/usr/share/icons/hicolor/128x128/apps/splitcat.png | |
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps | |
cp /home/runner/work/splitcat/splitcat/linux/flutter/assets/icons/256x256/icon.png AppDir/usr/share/icons/hicolor/256x256/apps/splitcat.png | |
- name: Copy Recipe to correct location | |
run: cp /home/runner/work/splitcat/splitcat/scripts/appimage/AppImageBuilder_x86_64.yml AppImageBuilder.yml | |
- name: List AppDir | |
run: ls AppDir/ | |
- name: Build AppImage | |
uses: AppImageCrafters/build-appimage@57c3bc6963f870ce3be103117de5b5e33ffbaeb6 | |
with: | |
recipe: ./AppImageBuilder.yml | |
- name: Find AppImage file | |
id: find_appimage | |
run: | | |
APPIMAGE_PATH=$(find . -name "*.AppImage" -print -quit) | |
echo "appimage_path=$APPIMAGE_PATH" >> $GITHUB_OUTPUT | |
echo "appimage_name=$(basename "$APPIMAGE_PATH")" >> $GITHUB_OUTPUT | |
- name: Upload AppImage to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} # Preuzima upload_url iz create_release joba | |
asset_path: ${{ steps.find_appimage.outputs.appimage_path }} | |
asset_name: ${{ steps.find_appimage.outputs.appimage_name }} | |
asset_content_type: application/octet-stream # MIME tip za AppImage | |
# build-apk: | |
# name: Build APK | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v3 | |
# | |
# - name: Set up Flutter | |
# uses: subosito/flutter-action@v2 | |
# with: | |
# flutter-version: '3.13.9' # Specify your Flutter version | |
# | |
# - name: Install dependencies | |
# run: | | |
# flutter pub get | |
# flutter clean | |
# - name: Build APK | |
# run: flutter build apk --release --verbose | |
# | |
# - name: Upload APK as artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: splitcat-apk | |
# path: build/app/outputs/flutter-apk/app-release.apk | |
# | |
# - name: Checkout repository | |
# uses: actions/checkout@v3 | |
# | |
# - name: Create Release | |
# uses: softprops/action-gh-release@v1 | |
# with: | |
# files: build/app/outputs/flutter-apk/app-release.apk | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |