Skip to content

Commit

Permalink
build from source (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
pugaizai authored Feb 17, 2025
1 parent a431b54 commit e382d68
Show file tree
Hide file tree
Showing 14 changed files with 6,087 additions and 72 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/autoupdate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Auto Update

on:
workflow_dispatch:
schedule:
- cron: "30 19 * * 1" # Run every Monday on 19:30 UTC
env:
FLATPAK_ID: com.gopeed.Gopeed
FLUTTER_VERSION: "3.24.5"
jobs:
flatpak-external-data-checker:
name: 'Check update'
runs-on: ubuntu-latest
outputs:
updated: ${{ steps.is-updated.outputs.updated }}
steps:
- uses: actions/checkout@v4
with:
repository: 'TheAppgineer/flatpak-flutter'

- uses: actions/checkout@v4

- uses: docker://ghcr.io/flathub/flatpak-external-data-checker:latest
with:
args: --edit-only ${{ env.FLATPAK_ID }}-online.yml

- uses: docker://ghcr.io/flathub/flatpak-external-data-checker:latest
with:
args: --edit-only ${{ env.FLATPAK_ID }}.yml

- name: Check updated
id: is-updated
run: |
git status -s -uno
[ -z "$(git status -s -uno)" ] || echo "updated=true" >> $GITHUB_OUTPUT
- name: Generate go/flutter sources
if: steps.is-updated.outputs.updated
run: |
sudo apt update
sudo apt install python3-yaml golang
go install github.com/dennwc/flatpak-go-mod@latest
export PATH="${PATH}:${HOME}/go/bin"
ver=$(grep release ${{ env.FLATPAK_ID }}.metainfo.xml | grep -m1 -oP '(?<=version=.)[^"]+')
git clone https://github.com/GopeedLab/gopeed.git -b "v${ver}" --depth 1
flatpak-go-mod gopeed
rm -rf gopeed
../flatpak-flutter.sh ${{ env.FLATPAK_ID }} ${{ env.FLUTTER_VERSION }}
- name: Upload artifact pub-git-cache
uses: actions/upload-artifact@v4
with:
# Artifact name
name: pub-git-cache
path: |
${{ env.FLATPAK_ID }}/pub-git-cache.tar.gz
- name: Reset
run: |
git checkout -- ${{ env.FLATPAK_ID }}.yml *.xml
- uses: docker://ghcr.io/flathub/flatpak-external-data-checker:latest
name: Recheck and open PR
env:
GIT_AUTHOR_NAME: Flatpak External Data Checker
GIT_COMMITTER_NAME: Flatpak External Data Checker
# email sets "github-actions[bot]" as commit author, see https://github.community/t/github-actions-bot-email-address/17204/6
GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: --update --never-fork ${{ env.FLATPAK_ID }}.yml

upload:
name: Create release and upload pub-git-cache.tar.gz
needs: [flatpak-external-data-checker]
if: ${{ needs.flatpak-external-data-checker.outputs.updated == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Inspect directory after downloading artifacts
run: ls -alFR
- name: Create release and upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
chmod +x pyuploadtool-x86_64.AppImage
./pyuploadtool-x86_64.AppImage pub-git-cache.tar.gz
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.flatpak-builder/
build/
gopeed/
pub-cache/
pub-git-cache.tar.gz
75 changes: 75 additions & 0 deletions com.gopeed.Gopeed-online.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This file is used to generate flutter sources
# https://github.com/TheAppgineer/flatpak-flutter
app-id: com.gopeed.Gopeed
runtime: org.freedesktop.Platform
runtime-version: '24.08'
sdk: org.freedesktop.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.llvm19
- org.freedesktop.Sdk.Extension.golang
command: gopeed
finish-args:
- --share=ipc
- --socket=wayland
- --socket=fallback-x11
- --share=network
- --device=dri
- --talk-name=org.kde.StatusNotifierWatcher
# https://github.com/miguelpruivo/flutter_file_picker/pull/1275
- --filesystem=xdg-download
- --own-name=com.gopeed.gopeed
cleanup:
- '*.a'
- '*.la'
- /include
- /lib/cmake
- /lib/pkgconfig
- /man
- /share/man
- /share/gtk-doc
modules:
- shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json
- name: Gopeed
buildsystem: simple
build-options:
arch:
x86_64:
env:
BUNDLE_PATH: build/linux/x64/release/bundle
aarch64:
env:
BUNDLE_PATH: build/linux/arm64/release/bundle
build-args:
- --share=network
append-path: /usr/lib/sdk/llvm19/bin:/usr/lib/sdk/golang/bin
prepend-ld-library-path: /usr/lib/sdk/llvm19/lib
env:
PUB_CACHE: /run/build/Gopeed/.pub-cache
build-commands:
- go build -mod=vendor -tags nosqlite -ldflags="-w -s -X github.com/GopeedLab/gopeed/pkg/base.Version=1.6.10"
-buildmode=c-shared -o ui/flutter/linux/bundle/lib/libgopeed.so ./bind/desktop
- go build -mod=vendor -ldflags="-w -s" -o ui/flutter/assets/host/host ./cmd/host
- cp -r ui/flutter/* .
- flutter/bin/flutter build linux --release --verbose
- cp -r ${BUNDLE_PATH}/* ${FLATPAK_DEST}/bin
- install -Dm644 com.gopeed.Gopeed.metainfo.xml -t ${FLATPAK_DEST}/share/metainfo
- install -Dm644 linux/assets/com.gopeed.Gopeed.desktop -t ${FLATPAK_DEST}/share/applications
- install -Dm644 assets/icon/icon.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/${FLATPAK_ID}.svg
- desktop-file-edit --set-key="Categories" --set-value="Utility;Network;" ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
sources:
- type: git
url: https://github.com/GopeedLab/gopeed.git
tag: v1.6.10
commit: 654e57e94694260f7c4af6ed0eddddfb06b5502b
x-checker-data:
type: git
tag-pattern: ^v([\d.]+)$
- type: file
path: com.gopeed.Gopeed.metainfo.xml
# go
- go.mod.yml
# flutter
- type: git
url: https://github.com/flutter/flutter.git
tag: 3.24.5
dest: flutter
71 changes: 0 additions & 71 deletions com.gopeed.Gopeed.yaml

This file was deleted.

77 changes: 77 additions & 0 deletions com.gopeed.Gopeed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
app-id: com.gopeed.Gopeed
runtime: org.freedesktop.Platform
runtime-version: '24.08'
sdk: org.freedesktop.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.llvm19
- org.freedesktop.Sdk.Extension.golang
command: gopeed
finish-args:
- --share=ipc
- --socket=wayland
- --socket=fallback-x11
- --share=network
- --device=dri
- --talk-name=org.kde.StatusNotifierWatcher
# https://github.com/miguelpruivo/flutter_file_picker/pull/1275
- --filesystem=xdg-download
- --own-name=com.gopeed.gopeed
cleanup:
- '*.a'
- '*.la'
- /include
- /lib/cmake
- /lib/pkgconfig
- /man
- /share/man
- /share/gtk-doc
- /var/lib
modules:
- shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json
- name: Gopeed
buildsystem: simple
build-options:
arch:
x86_64:
env:
BUNDLE_PATH: build/linux/x64/release/bundle
aarch64:
env:
BUNDLE_PATH: build/linux/arm64/release/bundle
append-path: /usr/lib/sdk/llvm19/bin:/usr/lib/sdk/golang/bin:/var/lib/flutter/bin
prepend-ld-library-path: /usr/lib/sdk/llvm19/lib
env:
PUB_CACHE: /run/build/Gopeed/.pub-cache
build-commands:
- go build -mod=vendor -tags nosqlite -ldflags="-w -s -X github.com/GopeedLab/gopeed/pkg/base.Version=1.6.10"
-buildmode=c-shared -o ui/flutter/linux/bundle/lib/libgopeed.so ./bind/desktop
- go build -mod=vendor -ldflags="-w -s" -o ui/flutter/assets/host/host ./cmd/host
- cp -r ui/flutter/* .
- mkdir -p build/native_assets/linux
- setup-flutter.sh
- flutter build linux --release --verbose
- cp -r ${BUNDLE_PATH}/* ${FLATPAK_DEST}/bin
- install -Dm644 com.gopeed.Gopeed.metainfo.xml -t ${FLATPAK_DEST}/share/metainfo
- install -Dm644 linux/assets/com.gopeed.Gopeed.desktop -t ${FLATPAK_DEST}/share/applications
- install -Dm644 assets/icon/icon.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/${FLATPAK_ID}.svg
- desktop-file-edit --set-key="Categories" --set-value="Utility;Network;" ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
sources:
- type: git
url: https://github.com/GopeedLab/gopeed.git
tag: v1.6.10
commit: 654e57e94694260f7c4af6ed0eddddfb06b5502b
x-checker-data:
type: git
tag-pattern: ^v([\d.]+)$
- type: file
path: com.gopeed.Gopeed.metainfo.xml
# go
- go.mod.yml
# flutter
- type: file
path: package_config.json
dest: flutter/packages/flutter_tools/.dart_tool
- pubspec-sources-flutter.json
- pubspec-sources-Gopeed.json
modules:
- flutter-sdk-3.24.5.json
4 changes: 4 additions & 0 deletions flathub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"automerge-flathubbot-prs": false,
"disable-external-data-checker": true
}
Loading

0 comments on commit e382d68

Please sign in to comment.