Skip to content

An open-source cross-platform alternative to AirDrop

ci: add AppImage to pipeline

Tien Do Nam4e1792c2ae33
diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml
index 488f586f..2805594d 100644
--- a/.github/release-drafter.yml
+++ b/.github/release-drafter.yml
@@ -1,4 +1,10 @@
template: |
- ## Changes
+ ### Summary
+
+ - insert summary here
+
+ ### Changes
$CHANGES
+
+ [Full Changelog](https://github.com/localsend/localsend/blob/main/assets/CHANGELOG.md)
diff --git a/.github/workflows/clear_workflows.yml b/.github/workflows/clear_workflows.yml
new file mode 100644
index 00000000..7c4ef0d1
--- /dev/null
+++ b/.github/workflows/clear_workflows.yml
@@ -0,0 +1,57 @@
+name: Delete old workflow runs
+on:
+ workflow_dispatch:
+ inputs:
+ days:
+ description: 'Number of days.'
+ required: true
+ default: 30
+ minimum_runs:
+ description: 'The minimum runs to keep for each workflow.'
+ required: true
+ default: 6
+ delete_workflow_pattern:
+ description: 'The name or filename of the workflow. if not set then it will target all workflows.'
+ required: false
+ delete_workflow_by_state_pattern:
+ description: 'Remove workflow by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually'
+ required: true
+ default: "All"
+ type: choice
+ options:
+ - "All"
+ - active
+ - deleted
+ - disabled_inactivity
+ - disabled_manually
+ delete_run_by_conclusion_pattern:
+ description: 'Remove workflow by conclusion: action_required, cancelled, failure, skipped, success'
+ required: true
+ default: "All"
+ type: choice
+ options:
+ - "All"
+ - action_required
+ - cancelled
+ - failure
+ - skipped
+ - success
+ dry_run:
+ description: 'Only log actions, do not perform any delete operations.'
+ required: false
+
+jobs:
+ del_runs:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Delete workflow runs
+ uses: Mattraks/delete-workflow-runs@c1a2f0de3fa4134a2357de83c92acff6e298bb8a # 2.0.3
+ with:
+ token: ${{ github.token }}
+ repository: ${{ github.repository }}
+ retain_days: ${{ github.event.inputs.days }}
+ keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
+ delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
+ delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }}
+ delete_run_by_conclusion_pattern: ${{ github.event.inputs.delete_run_by_conclusion_pattern }}
+ dry_run: ${{ github.event.inputs.dry_run }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 534140a6..2a89570a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,12 +1,7 @@
-name: Create Release Draft and Assets
+name: Release Draft
on:
workflow_dispatch:
- inputs:
- version:
- description: 'Version (e.g. "v1.10.0" without quotes)'
- type: string
- required: true
env:
FLUTTER_VERSION: "3.7.12"
@@ -14,15 +9,18 @@ env:
jobs:
build:
runs-on: ubuntu-20.04
+ outputs:
+ version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout code
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
- - name: Install dependencies
+ - name: Get version from pubspec.yaml
+ id: get_version
run: |
- sudo apt-get update
- sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev
+ VERSION=$(sed -n 's/^version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' pubspec.yaml)
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
- uses: subosito/flutter-action@v2
with:
@@ -35,6 +33,36 @@ jobs:
- name: Build generated files
run: flutter pub run build_runner build -d
+ - name: Upload updated lib files with generated code
+ uses: actions/upload-artifact@v3
+ with:
+ name: lib-files
+ path: ./lib/*
+
+ build_deb:
+ needs: build
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Download generated files
+ uses: actions/download-artifact@v3
+ with:
+ name: lib-files
+ path: lib
+
+ - 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: Enable dart_distributor
run: dart pub global activate flutter_distributor
@@ -47,11 +75,9 @@ jobs:
- name: Find deb file
id: find_deb
run: |
- VERSION=${{ github.event.inputs.version }}
- VERSION=${VERSION#v}
+ VERSION=${{ needs.build.outputs.version }}
DEB_PATH=$(find dist -name "localsend_app-$VERSION*-linux.deb")
echo "deb_path=$DEB_PATH" >> $GITHUB_OUTPUT
- echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if deb file exists
id: check_file
@@ -61,14 +87,92 @@ jobs:
exit 1
fi
+ - name: Upload deb file
+ uses: actions/upload-artifact@v3
+ with:
+ name: deb-result
+ path: ${{ steps.find_deb.outputs.deb_path }}
+
+ build_appimage:
+ needs: build
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Download generated files
+ uses: actions/download-artifact@v3
+ with:
+ name: lib-files
+ path: lib
+
+ - 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
+ run: flutter pub get
+
+ - name: Compile linux
+ run: flutter build linux
+
+ - name: Copy compiled linux files
+ run: |
+ mkdir AppDir
+ cp -r build/linux/x64/release/bundle/* AppDir/
+
+ - name: Copy logo to AppDir
+ run: |
+ mkdir -p AppDir/usr/share/icons/hicolor/32x32/apps
+ cp assets/img/logo-32.png AppDir/usr/share/icons/hicolor/32x32/apps/localsend.png
+ mkdir -p AppDir/usr/share/icons/hicolor/128x128/apps
+ cp assets/img/logo-128.png AppDir/usr/share/icons/hicolor/128x128/apps/localsend.png
+ mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
+ cp assets/img/logo-256.png AppDir/usr/share/icons/hicolor/256x256/apps/localsend.png
+
+ - name: Build AppImage
+ uses: AppImageCrafters/build-appimage@57c3bc6963f870ce3be103117de5b5e33ffbaeb6
+ with:
+ recipe: ./AppImageBuilder.yml
+
+ - name: Upload AppImage file
+ uses: actions/upload-artifact@v3
+ with:
+ name: appimage-result
+ path: ./*.AppImage
+
+ release:
+ needs: [build, build_deb, build_appimage]
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
- name: Draft release
id: draft_release
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- tag: ${{ github.event.inputs.version }}
- name: ${{ github.event.inputs.version }}
+ tag: v${{ needs.build.outputs.version }}
+ name: v${{ needs.build.outputs.version }}
+
+ - name: Download deb file
+ uses: actions/download-artifact@v3
+ with:
+ name: deb-result
+ path: deb-result
+
+ - name: Copy deb file to root
+ run: cp deb-result/*.deb result.deb
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
@@ -76,6 +180,33 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.draft_release.outputs.upload_url }}
- asset_path: ${{ steps.find_deb.outputs.deb_path }}
- asset_name: LocalSend-${{ steps.find_deb.outputs.version }}-x86-64.deb
+ asset_path: result.deb
+ asset_name: LocalSend-${{ needs.build.outputs.version }}-x86-64.deb
asset_content_type: application/vnd.debian.binary-package
+
+ - name: Download AppImage file
+ uses: actions/download-artifact@v3
+ with:
+ name: appimage-result
+ path: appimage-result
+
+ - name: List files in appimage-directory
+ run: ls -l appimage-result
+
+ - name: Copy AppImage file to root
+ run: |
+ for file in appimage-result/*; do
+ if [[ $file == *.AppImage && $file != *.AppImage.zsync ]]; then
+ cp "$file" result.AppImage
+ fi
+ done
+
+ - name: Upload Release Asset (AppImage)
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.draft_release.outputs.upload_url }}
+ asset_path: result.AppImage
+ asset_name: LocalSend-${{ needs.build.outputs.version }}-x86-64.AppImage
+ asset_content_type: application/x-appimage
diff --git a/AppImageBuilder.yml b/AppImageBuilder.yml
index 1086d3ba..05f345ef 100644
--- a/AppImageBuilder.yml
+++ b/AppImageBuilder.yml
@@ -1,11 +1,15 @@
# appimage-builder recipe see https://appimage-builder.readthedocs.io for details
version: 1
+script:
+ # Workaround for error in Github Actions (https://github.com/AppImageCrafters/appimage-builder/issues/271)
+ - which mksquashfs || apt install squashfs-tools
+
AppDir:
path: AppDir
app_info:
id: org.localsend.localsend_app
name: LocalSend
- icon: application-vnd.appimage
+ icon: localsend
version: latest
exec: localsend_app
exec_args: $@
@@ -21,9 +25,9 @@ AppDir:
- sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy multiverse
- sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
- sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
- - sourceline: deb http://security.ubuntu.com/ubuntu jammy-security main restricted
- - sourceline: deb http://security.ubuntu.com/ubuntu jammy-security universe
- - sourceline: deb http://security.ubuntu.com/ubuntu jammy-security multiverse
+ - sourceline: deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted
+ - sourceline: deb http://security.ubuntu.com/ubuntu/ jammy-security universe
+ - sourceline: deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse
include:
- libayatana-appindicator3-1:amd64
- librsvg2-common:amd64
@@ -40,22 +44,25 @@ AppDir:
- usr/share/doc/*/changelog.*
- usr/share/doc/*/NEWS.*
- usr/share/doc/*/TODO.*
- test:
- fedora-30:
- image: appimagecrafters/tests-env:fedora-30
- command: ./AppRun
- debian-stable:
- image: appimagecrafters/tests-env:debian-stable
- command: ./AppRun
- archlinux-latest:
- image: appimagecrafters/tests-env:archlinux-latest
- command: ./AppRun
- centos-7:
- image: appimagecrafters/tests-env:centos-7
- command: ./AppRun
- ubuntu-xenial:
- image: appimagecrafters/tests-env:ubuntu-xenial
- command: ./AppRun
+
+# Test cases do not work in Github Actions
+#
+# test:
+# fedora-30:
+# image: appimagecrafters/tests-env:fedora-30
+# command: ./AppRun
+# debian-stable:
+# image: appimagecrafters/tests-env:debian-stable
+# command: ./AppRun
+# archlinux-latest:
+# image: appimagecrafters/tests-env:archlinux-latest
+# command: ./AppRun
+# centos-7:
+# image: appimagecrafters/tests-env:centos-7
+# command: ./AppRun
+# ubuntu-xenial:
+# image: appimagecrafters/tests-env:ubuntu-xenial
+# command: ./AppRun
AppImage:
arch: x86_64
update-information: guess
diff --git a/assets/img/logo-128.png b/assets/img/logo-128.png
new file mode 100644
index 00000000..9affd87e
Binary files /dev/null and b/assets/img/logo-128.png differ
diff --git a/assets/img/logo-256.png b/assets/img/logo-256.png
new file mode 100644
index 00000000..b97748d3
Binary files /dev/null and b/assets/img/logo-256.png differ