config linux release
This commit is contained in:
1 parent
b7aacfdb0e
commit
171a6a5283
6 files changed
+225
-15
No files matched your search
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Usage: package_arch.sh <tag>
|
||||
TAG=${1:-dev}
|
||||
# strip leading 'v'
|
||||
VERSION="${TAG#v}"
|
||||
PKG_NAME="mashhad_metro"
|
||||
OUT_DIR="build"
|
||||
PKGDIR="pkgbuild"
|
||||
|
||||
echo "Packaging Arch package for $PKG_NAME version $VERSION"
|
||||
|
||||
rm -rf "$PKGDIR"
|
||||
mkdir -p "$PKGDIR/"{pkg,src}
|
||||
|
||||
# Copy binary
|
||||
if [ -f build/linux/x64/release/bundle/${PKG_NAME} ]; then
|
||||
mkdir -p "$PKGDIR/pkg/usr/bin"
|
||||
cp build/linux/x64/release/bundle/${PKG_NAME} "$PKGDIR/pkg/usr/bin/"
|
||||
else
|
||||
cp -r build/linux/ "$PKGDIR/pkg/opt/${PKG_NAME}" || true
|
||||
fi
|
||||
|
||||
# Include icon and desktop file in package
|
||||
mkdir -p "$PKGDIR/pkg/usr/share/icons/hicolor/128x128/apps"
|
||||
mkdir -p "$PKGDIR/pkg/usr/share/applications"
|
||||
if [ -f assets/icon/1.png ]; then
|
||||
cp assets/icon/1.png "$PKGDIR/pkg/usr/share/icons/hicolor/128x128/apps/${PKG_NAME}.png"
|
||||
fi
|
||||
|
||||
cat > "$PKGDIR/pkg/usr/share/applications/${PKG_NAME}.desktop" <<EOF
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Mashhad Metro
|
||||
Exec=/usr/bin/${PKG_NAME}
|
||||
Icon=${PKG_NAME}
|
||||
Categories=Utility;Education;
|
||||
Terminal=false
|
||||
EOF
|
||||
|
||||
cat > "$PKGDIR/PKGBUILD" <<EOF
|
||||
pkgname=${PKG_NAME}
|
||||
pkgver=${VERSION}
|
||||
pkgrel=1
|
||||
pkgdesc="Mashhad Metro Flutter App"
|
||||
arch=(x86_64)
|
||||
license=('custom')
|
||||
url="https://github.com/${GITHUB_REPOSITORY}"
|
||||
# Maintainer / packager
|
||||
# packager: shahriaarrr
|
||||
depends=()
|
||||
source=()
|
||||
build() {
|
||||
return 0
|
||||
}
|
||||
package() {
|
||||
mkdir -p "$pkgdir/usr/bin"
|
||||
cp -r pkg/usr/bin/* "$pkgdir/usr/bin/"
|
||||
}
|
||||
EOF
|
||||
|
||||
pushd "$PKGDIR"
|
||||
|
||||
# Use fakeroot and tar to create package; if 'makepkg' is available use it, otherwise create a tarball as fallback
|
||||
if command -v makepkg >/dev/null 2>&1; then
|
||||
makepkg --packagetype zst --noconfirm --syncdeps --skippgpcheck || true
|
||||
mv *.pkg.tar.* "../${OUT_DIR}/"
|
||||
else
|
||||
# Fallback: create a tar.zst of the pkg contents
|
||||
TARFILE="../${OUT_DIR}/${PKG_NAME}-${VERSION}.pkg.tar.zst"
|
||||
mkdir -p ../${OUT_DIR}
|
||||
tar -C pkg -cf - . | zstd -19 -T0 -o "$TARFILE"
|
||||
echo "Created fallback Arch package: $TARFILE"
|
||||
fi
|
||||
|
||||
popd
|
||||
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Usage: package_deb.sh <tag>
|
||||
TAG=${1:-dev}
|
||||
# strip leading 'v' if present
|
||||
VERSION="${TAG#v}"
|
||||
# binary name (from pubspec.yaml: name: mashhad_metro)
|
||||
PKG_NAME="mashhad_metro"
|
||||
BUILD_DIR="build/${PKG_NAME}-${VERSION}-deb"
|
||||
ARCH_DIR="$BUILD_DIR/usr/bin"
|
||||
ICON_DIR="$BUILD_DIR/usr/share/icons/hicolor/128x128/apps"
|
||||
DESKTOP_DIR="$BUILD_DIR/usr/share/applications"
|
||||
|
||||
echo "Packaging DEB for $PKG_NAME version $VERSION"
|
||||
|
||||
rm -rf "$BUILD_DIR"
|
||||
mkdir -p "$ARCH_DIR"
|
||||
mkdir -p "$ICON_DIR"
|
||||
mkdir -p "$DESKTOP_DIR"
|
||||
|
||||
# Copy the linux release binary (or executable bundle)
|
||||
if [ -f build/linux/x64/release/bundle/${PKG_NAME} ]; then
|
||||
cp build/linux/x64/release/bundle/${PKG_NAME} "$ARCH_DIR/"
|
||||
else
|
||||
# Try locate executable in build folder
|
||||
cp -r build/linux/ ${BUILD_DIR}/linux || true
|
||||
fi
|
||||
|
||||
# Copy application icon from repo assets if available
|
||||
if [ -f assets/icon/1.png ]; then
|
||||
cp assets/icon/1.png "$ICON_DIR/${PKG_NAME}.png"
|
||||
fi
|
||||
|
||||
# Create .desktop file
|
||||
cat > "$DESKTOP_DIR/${PKG_NAME}.desktop" <<EOF
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Mashhad Metro
|
||||
Exec=/usr/bin/${PKG_NAME}
|
||||
Icon=${PKG_NAME}
|
||||
Categories=Utility;Education;
|
||||
Terminal=false
|
||||
EOF
|
||||
|
||||
# Create control file
|
||||
mkdir -p "$BUILD_DIR/DEBIAN"
|
||||
cat > "$BUILD_DIR/DEBIAN/control" <<EOF
|
||||
Package: $PKG_NAME
|
||||
Version: $VERSION
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Maintainer: shahriaarrr
|
||||
Description: Mashhad Metro Flutter App (Linux)
|
||||
EOF
|
||||
|
||||
chmod -R 0755 "$BUILD_DIR"
|
||||
|
||||
DEB_FILE="build/${PKG_NAME}_${VERSION}_amd64.deb"
|
||||
mkdir -p build
|
||||
fakeroot dpkg-deb --build "$BUILD_DIR" "$DEB_FILE"
|
||||
|
||||
echo "Created $DEB_FILE"
|
||||
@@ -0,0 +1,77 @@
|
||||
name: Build and Release Flutter App (Linux)
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-attach:
|
||||
name: Build Linux and Attach to Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache Flutter SDK
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ runner.tool_cache }}/flutter
|
||||
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}-3.35.7
|
||||
restore-keys: |
|
||||
${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}-
|
||||
${{ runner.os }}-flutter-
|
||||
|
||||
- name: Set up Dart SDK
|
||||
uses: dart-lang/setup-dart@v1
|
||||
with:
|
||||
sdk: "3.9.2"
|
||||
|
||||
- name: Set up Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: "3.35.7"
|
||||
channel: "stable"
|
||||
cache: true
|
||||
|
||||
- name: Cache Dart & Flutter dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.pub-cache
|
||||
.dart_tool
|
||||
key: ${{ runner.os }}-dart-deps-${{ hashFiles('**/pubspec.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-dart-deps-
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Build Linux release
|
||||
run: flutter build linux --release
|
||||
|
||||
- name: Make packaging scripts executable
|
||||
run: |
|
||||
chmod +x .github/scripts/package_deb.sh || true
|
||||
chmod +x .github/scripts/package_arch.sh || true
|
||||
|
||||
- name: Package .deb
|
||||
run: .github/scripts/package_deb.sh ${{ github.ref_name }}
|
||||
|
||||
- name: Package Arch (pkg.tar.zst via Arch container)
|
||||
run: .github/scripts/package_arch.sh ${{ github.ref_name }}
|
||||
|
||||
- name: Attach packages to GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
files: |
|
||||
build/*.deb
|
||||
build/*.pkg.tar.*
|
||||
build/*.AppImage
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -15,24 +15,9 @@ migration:
|
||||
- platform: root
|
||||
create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
- platform: android
|
||||
create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
- platform: ios
|
||||
create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
- platform: linux
|
||||
create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
- platform: macos
|
||||
create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
- platform: web
|
||||
create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
- platform: windows
|
||||
create_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
base_revision: adc901062556672b4138e18a4dc62a4be8f4b3c2
|
||||
|
||||
# User provided section
|
||||
|
||||
|
||||
@@ -68,6 +68,13 @@ flutter_icons:
|
||||
ios: true
|
||||
image_path: "assets/icon/1.png"
|
||||
|
||||
linux:
|
||||
enable: true
|
||||
|
||||
windows:
|
||||
generate: true
|
||||
image_path: "assets/icon/1.png"
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 1.7 KiB |
Reference in new issue
Block a user