Dart #365
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 | |
| - uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: "3.6.0" | |
| - 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 get | |
| flutter pub upgrade | |
| - name: Extract version from pubspec.yaml | |
| id: extract_version | |
| run: | | |
| VERSION=$(grep -o 'version:.*' pubspec.yaml | awk '{print $2}') | |
| echo ::set-output name=version::"$VERSION" | |
| - 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 | |
| continue-on-error: true | |
| 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 }}-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 }}-armeabi-v7a.apk | |
| - name: Creating clone repo & apks | |
| continue-on-error: true | |
| run: | | |
| git clone https://github.com/namidaco/namida/ namida-clone | |
| cd namida-clone | |
| flutter clean | |
| flutter pub get | |
| 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 }}-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 }}-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/* | |
| token: ${{ secrets.SNAPSHOTS_REPO_SECRET }} | |
| - name: Upload all APKs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: all-apks | |
| path: build_final/** |