Dart #372
This file contains hidden or 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
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| name: Dart | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build_android: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| submodules: recursive | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version-file: pubspec.yaml | |
| - name: free disk space | |
| continue-on-error: true | |
| run: | | |
| sudo swapoff -a | |
| sudo rm -f /swapfile | |
| sudo apt clean | |
| docker rmi $(docker image ls -aq) | |
| df -h | |
| - name: remove unused SDKs | |
| continue-on-error: true | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/share/boost | |
| sudo rm -rf /usr/local/share/chromium | |
| sudo rm -rf /usr/local/share/vcpkg | |
| sudo rm -rf /usr/local/share/miniconda | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo rm -rf /opt/hostedtoolcache/go | |
| sudo rm -rf /opt/hostedtoolcache/Python | |
| sudo rm -rf /opt/hostedtoolcache/node | |
| sudo rm -rf /opt/hostedtoolcache/R | |
| sudo rm -rf /opt/hostedtoolcache/LLVM | |
| sudo rm -rf /opt/hostedtoolcache/Swift | |
| sudo rm -rf /opt/hostedtoolcache/Php | |
| sudo rm -rf /opt/hostedtoolcache/Perl | |
| sudo rm -rf /opt/hostedtoolcache/Scala | |
| sudo rm -rf /opt/hostedtoolcache/Julia | |
| sudo rm -rf /opt/hostedtoolcache/Mono | |
| sudo rm -rf /opt/hostedtoolcache/Crystal | |
| sudo rm -rf /opt/hostedtoolcache/Elixir | |
| sudo rm -rf /opt/hostedtoolcache/Erlang | |
| sudo rm -rf /opt/hostedtoolcache/FSharp | |
| sudo rm -rf /opt/hostedtoolcache/Haskell | |
| sudo rm -rf /opt/hostedtoolcache/OCaml | |
| sudo rm -rf /opt/hostedtoolcache/Rust | |
| sudo rm -rf /opt/hostedtoolcache/Sbt | |
| sudo rm -rf /opt/hostedtoolcache/Solidity | |
| sudo rm -rf /opt/hostedtoolcache/VisualStudio | |
| sudo rm -rf /opt/hostedtoolcache/WinAppDriver | |
| sudo rm -rf /opt/hostedtoolcache/Xamarin | |
| sudo rm -rf /opt/hostedtoolcache/Yarn | |
| sudo rm -rf /opt/hostedtoolcache/Zephyr | |
| sudo rm -rf /opt/hostedtoolcache/zig | |
| sudo rm -rf /opt/hostedtoolcache/azcopy | |
| - name: setup credentials | |
| run: | | |
| git config --global url.https://${{ secrets.PAT_ORG }}@github.com/namidaco/.insteadOf https://github.com/namidaco/ | |
| git config --global url.https://${{ secrets.PAT }}@github.com/MSOB7YY/.insteadOf https://github.com/MSOB7YY/ | |
| - name: Setup dependencies | |
| run: | | |
| flutter clean | |
| flutter pub upgrade | |
| git submodule update --init --remote --recursive | |
| - name: Extract version from pubspec.yaml | |
| id: extract_version | |
| run: | | |
| VERSION=$(grep -o 'version:.*' pubspec.yaml | awk '{print $2}') | |
| VERSION_NAME=$(echo $VERSION | cut -d'+' -f1) | |
| echo ::set-output name=version::"$VERSION" | |
| echo ::set-output name=version_name::"$VERSION_NAME" | |
| - uses: actions/setup-java@v1 | |
| with: | |
| java-version: "17" | |
| - name: Create keystore & key.properties | |
| run: | | |
| echo ${{ secrets.ANDROID_SIGNING_KEYSTORE }} | base64 --decode > android/app/keystore.jks | |
| echo ${{ secrets.ANDROID_SIGNING_KEY_PROPERTIES }} | base64 --decode > android/key.properties | |
| - name: Creating original apks | |
| run: | | |
| mkdir -p build_final | |
| flutter build apk --target-platform android-arm64 --split-per-abi --release | |
| mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk build_final/namida-v${{ steps.extract_version.outputs.version_name }}-arm64-v8a.apk | |
| flutter build apk --target-platform android-arm --split-per-abi --release | |
| mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk build_final/namida-v${{ steps.extract_version.outputs.version_name }}-armeabi-v7a.apk | |
| - name: Creating clone repo & apks | |
| continue-on-error: true | |
| run: | | |
| # without new clone, cache gets messed up | |
| git clone https://github.com/namidaco/namida/ namida-clone | |
| cd namida-clone | |
| flutter clean | |
| flutter pub upgrade | |
| git submodule update --init --remote --recursive | |
| find ./ -type f -exec sed -i -e 's/com.msob7y.namida/com.msob7y.namida.snapshot/g' {} \; | |
| echo ${{ secrets.ANDROID_SIGNING_KEYSTORE }} | base64 --decode > android/app/keystore.jks | |
| echo ${{ secrets.ANDROID_SIGNING_KEY_PROPERTIES }} | base64 --decode > android/key.properties | |
| mkdir -p ../build_final | |
| flutter build apk --target-platform android-arm64 --split-per-abi --release | |
| mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ../build_final/namida-v${{ steps.extract_version.outputs.version_name }}-clone-arm64-v8a.apk | |
| flutter build apk --target-platform android-arm --split-per-abi --release | |
| mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ../build_final/namida-v${{ steps.extract_version.outputs.version_name }}-clone-armeabi-v7a.apk | |
| cd ../ | |
| # - name: Setup Linux | |
| # run: | | |
| # sudo apt-get update -y && sudo apt-get upgrade -y | |
| # sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev libstdc++-12-dev mpv libmpv-dev alsa-base alsa-utils alsa-tools dpkg-dev rpm jq makepkg | |
| # dart pub global deactivate fastforge_workspace || true | |
| # dart pub global deactivate fastforge || true | |
| # dart pub global activate --source git https://github.com/MSOB7YY/fastforge.git | |
| # dart pub global activate --source git https://github.com/MSOB7YY/fastforge.git --git-path "packages/fastforge" | |
| # - name: Creating Linux deb/rpm/tar.gz | |
| # run: | | |
| # dart ./scripts/bundle.dart | |
| # mkdir -p build_final | |
| # mv ./scripts/bundle_output/* build_final/ || echo "No files to move" | |
| # - name: Publish to AUR | |
| # run: | | |
| # # Setup SSH for AUR | |
| # mkdir -p ~/.ssh | |
| # echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/aur | |
| # chmod 600 ~/.ssh/aur | |
| # ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts | |
| # cat >> ~/.ssh/config << EOF | |
| # Host aur.archlinux.org | |
| # IdentityFile ~/.ssh/aur | |
| # User aur | |
| # EOF | |
| # chmod 600 ~/.ssh/config | |
| # # Parse version string (5.6.5-beta+260114196) | |
| # FULL_VERSION="${{ steps.extract_version.outputs.version }}" | |
| # PKGVER=$(echo "$FULL_VERSION" | sed 's/-beta+.*//') | |
| # BUILDNUMBER=$(echo "$FULL_VERSION" | sed 's/.*+//') | |
| # # Clone AUR package | |
| # git clone ssh://aur@aur.archlinux.org/namida-bin.git namida_aur | |
| # cd namida_aur | |
| # # Update version and build number in PKGBUILD | |
| # sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" PKGBUILD | |
| # sed -i "s/^_buildnumber=.*/_buildnumber=${BUILDNUMBER}/" PKGBUILD | |
| # sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD | |
| # # Calculate checksum from the local tarball | |
| # TARBALL="../build_final/namida-v${PKGVER}-beta.linux.tar.gz" | |
| # if [ -f "$TARBALL" ]; then | |
| # NEW_SHA256=$(sha256sum "$TARBALL" | awk '{print $1}') | |
| # sed -i "s/^sha256sums=.*/sha256sums=('${NEW_SHA256}')/" PKGBUILD | |
| # else | |
| # echo "Warning: Tarball not found at $TARBALL" | |
| # ls -la ../build_final/ | |
| # fi | |
| # # Generate .SRCINFO | |
| # makepkg --printsrcinfo > .SRCINFO | |
| # # Commit and push to AUR | |
| # git config user.name "MSOB7YY" | |
| # git config user.email "${{ secrets.EMAIL }}" | |
| # git add PKGBUILD .SRCINFO | |
| # git commit -m "update to v${PKGVER} (build ${BUILDNUMBER})" | |
| # git push origin master | |
| # cd .. | |
| - name: Get the previous release date | |
| continue-on-error: true | |
| run: | | |
| release_info=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/namidaco/namida-snapshots/releases/latest) | |
| release_date=$(echo "$release_info" | jq -r '.published_at') | |
| echo "PREVIOUS_RELEASE_DATE=$release_date" >> $GITHUB_ENV | |
| - name: Generate Changelog | |
| continue-on-error: true | |
| run: | | |
| bash scripts/gen_beta_changelog.sh | |
| cat ./scripts/beta_changelog.md | |
| - name: Creating Snapshot Release at namida-snapshots | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| repository: namidaco/namida-snapshots | |
| make_latest: true | |
| draft: false | |
| tag_name: ${{ steps.extract_version.outputs.version}} | |
| # body_path: ./beta_changelog.md | |
| files: | | |
| build_final/* | |
| ./beta_changelog.md | |
| token: ${{ secrets.SNAPSHOTS_REPO_SECRET }} | |
| - name: Upload all APKs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: all-apks | |
| path: build_final/** | |
| build_linux: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: archlinux:latest | |
| steps: | |
| - name: Install base dependencies | |
| run: | | |
| pacman-key --init | |
| pacman-key --populate archlinux | |
| pacman -Sy --noconfirm archlinux-keyring | |
| pacman -Su --noconfirm | |
| pacman -S --noconfirm \ | |
| base-devel git curl wget jq openssh unzip xz rust \ | |
| clang cmake ninja pkgconf gcc gtk3 libstdc++ \ | |
| mpv alsa-lib libx11 libxrender libxext mesa libgl \ | |
| libepoxy libdrm wayland libxkbcommon glibc binutils | |
| pacman -Scc --noconfirm | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| submodules: recursive | |
| - name: Fix git ownership | |
| run: git config --global --add safe.directory /__w/namida/namida | |
| - name: Setup Git credentials | |
| run: | | |
| git config --global url.https://${{ secrets.PAT_ORG }}@github.com/namidaco/.insteadOf https://github.com/namidaco/ | |
| git config --global url.https://${{ secrets.PAT }}@github.com/MSOB7YY/.insteadOf https://github.com/MSOB7YY/ | |
| # needed for AUR cloning | |
| git config --global user.name "MSOB7YY" | |
| git config --global user.email "${{ secrets.EMAIL }}" | |
| - name: Install Flutter | |
| run: | | |
| FLUTTER_VERSION=$(grep 'flutter:' pubspec.yaml | grep -v '#' | head -1 | awk '{print $2}' || echo "") | |
| git clone https://github.com/flutter/flutter.git /opt/flutter --depth 1 ${FLUTTER_VERSION:+-b $FLUTTER_VERSION} | |
| export PATH="/opt/flutter/bin:$PATH" | |
| echo "PATH=/opt/flutter/bin:$PATH" >> $GITHUB_ENV | |
| flutter precache --linux | |
| flutter config --no-analytics | |
| - name: Setup Flutter dependencies | |
| run: | | |
| export PATH="/opt/flutter/bin:/opt/dart-sdk/bin:$PATH" | |
| flutter clean | |
| flutter pub upgrade | |
| git submodule update --init --remote --recursive | |
| - name: Extract version from pubspec.yaml | |
| id: extract_version | |
| run: | | |
| VERSION=$(grep -o 'version:.*' pubspec.yaml | awk '{print $2}') | |
| VERSION_NAME=$(echo $VERSION | cut -d'+' -f1) | |
| echo ::set-output name=version::"$VERSION" | |
| echo ::set-output name=version_name::"$VERSION_NAME" | |
| - name: Install fastforge | |
| run: | | |
| export PATH="/opt/flutter/bin:/opt/dart-sdk/bin:$PATH" | |
| dart pub global deactivate fastforge_workspace || true | |
| dart pub global deactivate fastforge || true | |
| dart pub global activate --source git https://github.com/MSOB7YY/fastforge.git | |
| dart pub global activate --source git https://github.com/MSOB7YY/fastforge.git --git-path "packages/fastforge" | |
| echo "PATH=$HOME/.pub-cache/bin:$PATH" >> $GITHUB_ENV | |
| - name: Build Linux TEST | |
| run: | | |
| export PATH="/opt/flutter/bin:/opt/dart-sdk/bin:$HOME/.pub-cache/bin:$PATH" | |
| flutter build linux --release --verbose | |
| - name: Build Linux deb/rpm/tar.gz | |
| run: | | |
| export PATH="/opt/flutter/bin:/opt/dart-sdk/bin:$HOME/.pub-cache/bin:$PATH" | |
| dart ./scripts/bundle.dart | |
| mkdir -p build_final | |
| mv ./scripts/bundle_output/* build_final/ || echo "No files to move" | |
| - name: Upload Linux artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-builds | |
| path: build_final/** | |
| - name: Publish to AUR | |
| run: | | |
| # Setup SSH for AUR | |
| mkdir -p ~/.ssh | |
| chmod 700 ~/.ssh | |
| echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/aur | |
| chmod 600 ~/.ssh/aur | |
| touch ~/.ssh/known_hosts | |
| chmod 644 ~/.ssh/known_hosts | |
| ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts | |
| cat > ~/.ssh/config <<EOF | |
| Host aur.archlinux.org | |
| HostName aur.archlinux.org | |
| IdentityFile ~/.ssh/aur | |
| User aur | |
| IdentitiesOnly yes | |
| StrictHostKeyChecking yes | |
| EOF | |
| chmod 600 ~/.ssh/config | |
| # verify connection before proceeding | |
| ssh -T aur@aur.archlinux.org || true | |
| # Parse version string (e.g. 5.6.5-beta+260114196) | |
| FULL_VERSION="${{ steps.extract_version.outputs.version }}" | |
| PKGVER=$(echo "$FULL_VERSION" | sed 's/-beta+.*//') | |
| BUILDNUMBER=$(echo "$FULL_VERSION" | sed 's/.*+//') | |
| # Clone AUR package | |
| git clone ssh://aur@aur.archlinux.org/namida-bin.git namida_aur | |
| cd namida_aur | |
| # Update version and build number in PKGBUILD | |
| sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" PKGBUILD | |
| sed -i "s/^_buildnumber=.*/_buildnumber=${BUILDNUMBER}/" PKGBUILD | |
| sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD | |
| # Calculate checksum from the local tarball | |
| TARBALL="../build_final/namida-v${PKGVER}-beta.linux.tar.gz" | |
| if [ -f "$TARBALL" ]; then | |
| NEW_SHA256=$(sha256sum "$TARBALL" | awk '{print $1}') | |
| sed -i "s/^sha256sums=.*/sha256sums=('${NEW_SHA256}')/" PKGBUILD | |
| else | |
| echo "Warning: Tarball not found at $TARBALL" | |
| ls -la ../build_final/ | |
| fi | |
| # Generate .SRCINFO | |
| makepkg --printsrcinfo > .SRCINFO | |
| # Commit and push to AUR | |
| git add PKGBUILD .SRCINFO | |
| git commit -m "update to v${PKGVER} (build ${BUILDNUMBER})" | |
| git push origin master | |
| build_windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| submodules: recursive | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version-file: pubspec.yaml | |
| - name: Setup credentials | |
| run: | | |
| git config --global url.https://${{ secrets.PAT_ORG }}@github.com/namidaco/.insteadOf https://github.com/namidaco/ | |
| git config --global url.https://${{ secrets.PAT }}@github.com/MSOB7YY/.insteadOf https://github.com/MSOB7YY/ | |
| - name: Setup dependencies | |
| run: | | |
| flutter clean | |
| flutter pub upgrade | |
| git submodule update --init --remote --recursive | |
| - name: Extract version from pubspec.yaml | |
| id: extract_version | |
| run: | | |
| $VERSION = (Select-String -Path pubspec.yaml -Pattern 'version:').Line.Split(' ')[1] | |
| $VERSION_NAME = $VERSION.Split('+')[0] | |
| echo "version=$VERSION" >> $env:GITHUB_OUTPUT | |
| echo "version_name=$VERSION_NAME" >> $env:GITHUB_OUTPUT | |
| - name: Set up Inno | |
| run: | | |
| Invoke-WebRequest -Uri 'https://jrsoftware.org/download.php/is.exe' -OutFile 'inno.exe' | |
| Start-Process -FilePath 'inno.exe' -ArgumentList '/VERYSILENT' | |
| - name: Build Windows Installer | |
| run: dart run inno_bundle:build --release | |
| - name: Upload installer to Snapshot Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| repository: namidaco/namida-snapshots | |
| make_latest: true | |
| draft: false | |
| tag_name: ${{ steps.extract_version.outputs.version }} | |
| files: | | |
| ./build/windows/x64/installer/Release/Namida-x86_64-${{ steps.extract_version.outputs.version_name }}-Installer.exe | |
| token: ${{ secrets.SNAPSHOTS_REPO_SECRET }} |