From 821a9b88171f97bbc81f9fff2924997e128ea877 Mon Sep 17 00:00:00 2001 From: "don.cryptus" Date: Wed, 13 Dec 2023 21:51:31 +0100 Subject: [PATCH] Add dependencies and create RPM package --- .github/workflows/release.yml | 147 ++++++++++++++++------------------ README.md | 8 +- package.json | 2 +- src-tauri/Cargo.lock | 27 +++---- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 5 +- 6 files changed, 87 insertions(+), 104 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 207a4e6b..19e16aaf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,28 +8,28 @@ concurrency: group: ${{ github.ref }} cancel-in-progress: true env: - EMAIL: don.cryptus@gmail.com ARCH: x86_64 + DEPENDENCIES_ARCH: "'libappindicator-gtk3' 'webkit2gtk' 'gtk3' 'xdotool'" + DEPENDENCIES_RPM: "javascriptcoregtk4.0, webkit2gtk4.0, libxdo, libappindicator-gtk3, xdotool" jobs: setup: runs-on: ubuntu-latest - permissions: - contents: write outputs: - arch: ${{ env.ARCH }} - email: ${{ env.EMAIL }} name: ${{ steps.get-package.outputs.name }} - name-bin: ${{ steps.get-package.outputs.name }}-bin + name_bin: ${{ steps.get-package.outputs.name }}-bin version: ${{ steps.get-package.outputs.version }} description: ${{ steps.get-package.outputs.description }} license: ${{ steps.get-package.outputs.license }} - deb-pkg-name: ${{ steps.get-package.outputs.name }}_${{ steps.get-package.outputs.version }}_amd64.deb - deb-pkg-path: ./src-tauri/target/release/bundle/deb/ - tag-name: v${{ steps.get-package.outputs.version }} + deb_pkg_name: ${{ steps.get-package.outputs.name }}_${{ steps.get-package.outputs.version }}_amd64.deb + deb_pkg_path: ./src-tauri/target/release/bundle/deb/ + deb_pkg_renamed: ${{ steps.get-package.outputs.name }}-${{ steps.get-package.outputs.version }}-${{ env.ARCH }}.deb + arch_pkg_name: ${{ steps.get-package.outputs.name }}-bin-${{ steps.get-package.outputs.version }}-1-${{ env.ARCH }}.pkg.tar.zst + rpm_pkg_name: RPMS/${{ steps.get-package.outputs.name }}-${{ steps.get-package.outputs.version }}-1.${{ env.ARCH }}.rpm + tag_name: v${{ steps.get-package.outputs.version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: setup node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20 - name: get package info @@ -38,11 +38,7 @@ jobs: echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_OUTPUT echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT echo "description=$(node -p "require('./package.json').description")" >> $GITHUB_OUTPUT - - # - uses: dev-drprasad/delete-tag-and-release@v1.0 - # with: - # tag_name: v${{ steps.get-package.outputs.version }} - # github_token: ${{ secrets.GITHUB_TOKEN }} + echo "license=$(node -p "require('./package.json').license")" >> $GITHUB_OUTPUT build-tauri: @@ -54,18 +50,6 @@ jobs: matrix: platform: [macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.platform }} - env: - TAG_NAME: ${{ needs.setup.outputs.tag-name }} - BIN_PATH: ${{ needs.setup.outputs.name-bin }} - DESCRIPTION: ${{ needs.setup.outputs.description }} - LICENSE: ${{ needs.setup.outputs.license }} - DEB_PKG_NAME: ${{ needs.setup.outputs.deb-pkg-name }} - DEB_PKG_PATH: ${{ needs.setup.outputs.deb-pkg-path }} - DEB_PKG_RENAMED: ${{ needs.setup.outputs.name }}-${{ needs.setup.outputs.version }}-${{ needs.setup.outputs.arch }}.deb # leave as is it needs to be renamed for the arch build - ARCH_PKG_NAME: ${{ needs.setup.outputs.name-bin }}-${{ needs.setup.outputs.version }}-1-${{ needs.setup.outputs.arch }}.pkg.tar.zst - RPM_PKG_NAME: ${{ needs.setup.outputs.name }}-${{ needs.setup.outputs.version }}-1.${{ needs.setup.outputs.arch }}.rpm - PACKAGE_VERSION: ${{ needs.setup.outputs.version }} - PACKAGE_NAME: ${{ needs.setup.outputs.name }} steps: - uses: actions/checkout@v4 @@ -75,15 +59,6 @@ jobs: with: node-version: 20 - # - uses: mukunku/tag-exists-action@v1.4.0 - # id: checkTag - # with: - # tag: '${{ env.TAG_NAME }}' - - # - name: stop jobs if tag exist - # if: steps.checkTag.outputs.exists == 'true' - # run: exit 1 - - name: install rust stable uses: dtolnay/rust-toolchain@stable @@ -93,7 +68,7 @@ jobs: sudo apt-get update wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb - sudo apt-get install -y openssl alien libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev libxcb-shape0-dev libxcb-xfixes0-dev libxdo-dev + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev libxcb-shape0-dev libxcb-xfixes0-dev libxdo-dev - name: install frontend dependencies run: yarn install @@ -102,42 +77,28 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tagName: ${{ env.TAG_NAME }} - releaseName: ${{ env.TAG_NAME }} + tagName: ${{ needs.setup.outputs.tag_name }} + releaseName: ${{ needs.setup.outputs.tag_name }} releaseDraft: false prerelease: false - - name: upload deb (ubuntu only) - if: matrix.platform == 'ubuntu-latest' - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} - asset_name: ${{ env.DEB_PKG_NAME }} - tag: ${{ env.TAG_NAME }} - overwrite: true - - - name: copy deb package && create PKGBUILD (ubuntu only) + - name: copy deb package && create PKGBUILD file (ubuntu only) if: matrix.platform == 'ubuntu-latest' run: | - mkdir ${{ env.BIN_PATH }} - cp -fr ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} ${{ env.BIN_PATH }}/${{ env.DEB_PKG_RENAMED }} - cat < ./${{ env.BIN_PATH }}/PKGBUILD - # Maintainer: ${{ github.repository_owner }} <${{ env.EMAIL }}> - # Contributor: ${{ github.repository_owner }} <${{ env.EMAIL }}> - _packager="${{ github.repository_owner }} <${{ env.EMAIL }}>" - _deb_pkgname=${{ env.PACKAGE_NAME }} - pkgname=${{ env.BIN_PATH }} - pkgver=${{ env.PACKAGE_VERSION }} - md5sums=('$(md5sum ${{ env.BIN_PATH }}/${{ env.DEB_PKG_RENAMED }} | awk '{print $1}')') + mkdir -p ${{ needs.setup.outputs.name_bin }} + cp -fr ${{ needs.setup.outputs.deb_pkg_path }}${{ needs.setup.outputs.deb_pkg_name }} ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }} + cat < ./${{ needs.setup.outputs.name_bin }}/PKGBUILD + pkgname=${{ needs.setup.outputs.name_bin }} + pkgver=${{ needs.setup.outputs.version }} + md5sums=('$(md5sum ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }} | awk '{print $1}')') pkgrel=1 - depends=('libappindicator-gtk3' 'webkit2gtk' 'gtk3' 'xdotool') - pkgdesc='${{ env.DESCRIPTION }}' + depends=(${{ env.DEPENDENCIES_ARCH }}) + pkgdesc='${{ needs.setup.outputs.description }}' arch=('${{ env.ARCH }}') url="https://github.com/${{ github.repository }}" - license=('${{ env.LICENSE }}') - source=("\$url/releases/download/${{ env.TAG_NAME }}/${{ env.DEB_PKG_RENAMED }}") + license=('${{ needs.setup.outputs.license }}') + source=("\$url/releases/download/${{ needs.setup.outputs.tag_name }}/${{ needs.setup.outputs.deb_pkg_renamed }}") build() { rm control.tar.gz @@ -148,8 +109,7 @@ jobs: cp -fr usr/ \${pkgdir} } EOF - cat ${{ env.BIN_PATH }}/PKGBUILD - ls -la ${{ env.BIN_PATH }} + cat ${{ needs.setup.outputs.name_bin }}/PKGBUILD - name: create arch package (ubuntu only) if: matrix.platform == 'ubuntu-latest' @@ -157,25 +117,56 @@ jobs: with: debug: true target: pkgbuild - pkgname: ${{ env.BIN_PATH }}/ + pkgname: ${{ needs.setup.outputs.name_bin }}/ - - name: create rpm package (ubuntu only) + - name: copy deb package && create rpm.spec file (ubuntu only) if: matrix.platform == 'ubuntu-latest' - run: sudo alien -r -k --scripts --target=x86_64 ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} + run: | + mkdir -p ${{ needs.setup.outputs.name_bin }} + cp -fr ${{ needs.setup.outputs.deb_pkg_path }}/${{ needs.setup.outputs.deb_pkg_name }} ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }} + cat < ./${{ needs.setup.outputs.name_bin }}/rpm.spec + Name: ${{ needs.setup.outputs.name }} + Version: ${{ needs.setup.outputs.version }} + BuildArch: ${{ env.ARCH }} + Release: 1 + Summary: ${{ needs.setup.outputs.description }} + Requires: ${{ env.DEPENDENCIES_RPM }} + License: ${{ needs.setup.outputs.license }} + Source0: ${{ needs.setup.outputs.deb_pkg_renamed }} + + %description + ${{ needs.setup.outputs.description }} + + %prep + ar x %{SOURCE0} + + %build + rm -rf control.tar.gz + tar xvf data.tar.gz + + %install + cp -fr usr/ %{buildroot} + + %files + %{_bindir}/${{ needs.setup.outputs.name }} + /usr/share/applications/${{ needs.setup.outputs.name }}.desktop + /usr/share/icons/hicolor/**/* + EOF + cat ${{ needs.setup.outputs.name_bin }}/rpm.spec - - name: create checksums (ubuntu only) + - name: createa rpm package (ubuntu only) if: matrix.platform == 'ubuntu-latest' - run: | - md5sum ${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME}} > ${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }}.md5sum - md5sum ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }} > ${{ env.DEB_PKG_NAME }}.md5sum - md5sum ${{ env.RPM_PKG_NAME }} > ${{ env.RPM_PKG_NAME }}.md5sum + uses: Antikythera/build-rpm@latest + with: + spec_file: ${{ needs.setup.outputs.name_bin }}/rpm.spec + sources: ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.deb_pkg_renamed }} - name: upload arch && rpm release (ubuntu only) if: matrix.platform == 'ubuntu-latest' uses: softprops/action-gh-release@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - tag_name: ${{ env.TAG_NAME }} + tag_name: ${{ needs.setup.outputs.tag_name }} files: | - ${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }} - ${{ env.RPM_PKG_NAME }} \ No newline at end of file + ${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.arch_pkg_name }} + ${{ needs.setup.outputs.rpm_pkg_name }} \ No newline at end of file diff --git a/README.md b/README.md index 6a741b33..25396b8f 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,6 @@ successor of [the electron clippy](https://github.com/Don-Cryptus/clippy-ts) - change keyboard bindings - dark mode / white mode -### Prerequisites Fedora Linux - -```bash -sudo dnf install javascriptcoregtk4.0 webkit2gtk4.0 libxdo libappindicator-gtk3 xdotool -``` ### Prerequisites Development @@ -66,5 +61,4 @@ Before you begin, ensure you have met the following requirements: #### note -Tested on Linux(x11), Windows -on Mac still lots of issues with hotkeys you probably need to change the hotkey \ No newline at end of file +Tested on Linux(x11), Windows, Mac (hotkeys needs to be changed in settings) \ No newline at end of file diff --git a/package.json b/package.json index 4bea6ee0..3717b29f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clippy", - "version": "1.2.3", + "version": "1.2.4", "description": "Clipboard Manager built with Rust & Typescript", "license": "MIT", "type": "module", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 41a455e7..803bf32c 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -879,7 +879,7 @@ dependencies = [ [[package]] name = "clippy" -version = "1.2.3" +version = "1.2.4" dependencies = [ "arboard", "base64 0.21.5", @@ -1078,9 +1078,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" dependencies = [ "cfg-if", "crossbeam-utils", @@ -1088,9 +1088,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -1099,22 +1099,21 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", "memoffset 0.9.0", - "scopeguard", ] [[package]] name = "crossbeam-queue" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +checksum = "b9bcf5bdbfdd6030fb4a1c497b5d5fc5921aa2f60d359a17e249c0e6df3de153" dependencies = [ "cfg-if", "crossbeam-utils", @@ -1122,9 +1121,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" dependencies = [ "cfg-if", ] @@ -2231,9 +2230,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hkdf" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ "hmac", ] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index ee783a8c..d83828f5 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "1.2.3" +version = "1.2.4" description = "Clipboard Manager built with Rust & Typescript" authors = ["Don-Cryptus"] license = "MIT" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 70bd3928..28b5a3ac 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "clippy", - "version": "1.2.3" + "version": "1.2.4" }, "tauri": { "allowlist": { @@ -41,8 +41,7 @@ ], "deb": { "depends": [ - "libxdo3", - "xdotool" + "libxdo3" ] } },