Skip to content

Commit

Permalink
Add dependencies and create RPM package
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Dec 13, 2023
1 parent adccbf1 commit 821a9b8
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 104 deletions.
147 changes: 69 additions & 78 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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 <<EOF > ./${{ 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 <<EOF > ./${{ 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
Expand All @@ -148,34 +109,64 @@ 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'
uses: 2m/arch-pkgbuild-builder@v1.17
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 <<EOF > ./${{ 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 }}
${{ needs.setup.outputs.name_bin }}/${{ needs.setup.outputs.arch_pkg_name }}
${{ needs.setup.outputs.rpm_pkg_name }}
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Tested on Linux(x11), Windows, Mac (hotkeys needs to be changed in settings)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
27 changes: 13 additions & 14 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
5 changes: 2 additions & 3 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "clippy",
"version": "1.2.3"
"version": "1.2.4"
},
"tauri": {
"allowlist": {
Expand Down Expand Up @@ -41,8 +41,7 @@
],
"deb": {
"depends": [
"libxdo3",
"xdotool"
"libxdo3"
]
}
},
Expand Down

0 comments on commit 821a9b8

Please sign in to comment.