Skip to content

Add dependencies and create RPM package #340

Add dependencies and create RPM package

Add dependencies and create RPM package #340

Workflow file for this run

name: "publish"
on:
workflow_dispatch:
push:
branches: [master]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
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 }}
name: ${{ steps.get-package.outputs.name }}
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 }}
steps:
- uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: get package info
id: get-package
run: |
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
echo "license=$(node -p "require('./package.json').license")" >> $GITHUB_OUTPUT
# - uses: dev-drprasad/[email protected]
# with:
# tag_name: v${{ steps.get-package.outputs.version }}
# github_token: ${{ secrets.GITHUB_TOKEN }}
build-tauri:
needs: [setup]
permissions:
contents: write
strategy:
fail-fast: false
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: RPMS/${{ 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
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
# - uses: mukunku/[email protected]
# 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
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
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
- name: install frontend dependencies
run: yarn install
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ env.TAG_NAME }}
releaseName: ${{ env.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)
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
pkgname=${{ env.BIN_PATH }}
pkgver=${{ env.PACKAGE_VERSION }}
md5sums=('$(md5sum ${{ env.BIN_PATH }}/${{ env.DEB_PKG_RENAMED }} | awk '{print $1}')')
pkgrel=1
depends=(${{ env.DEPENDENCIES_ARCH }})
pkgdesc='${{ env.DESCRIPTION }}'
arch=('${{ env.ARCH }}')
url="https://github.com/${{ github.repository }}"
license=('${{ env.LICENSE }}')
source=("\$url/releases/download/${{ env.TAG_NAME }}/${{ env.DEB_PKG_RENAMED }}")
build() {
rm control.tar.gz
tar xvf data.tar.gz
}
package() {
cp -fr usr/ \${pkgdir}
}
EOF
cat ${{ env.BIN_PATH }}/PKGBUILD
ls -la ${{ env.BIN_PATH }}
- name: create arch package (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
uses: 2m/[email protected]
with:
debug: true
target: pkgbuild
pkgname: ${{ env.BIN_PATH }}/
- name: copy deb package && create .spec file
if: matrix.platform == 'ubuntu-latest'
run: |
mkdir -p ${{ 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 }}/rpm.spec
Name: ${{ env.PACKAGE_NAME }}
Version: ${{ env.PACKAGE_VERSION }}
BuildArch: ${{ env.ARCH }}
Release: 1
Summary: ${{ env.DESCRIPTION }}
Requires: ${{ env.DEPENDENCIES_RPM }}
License: ${{ env.LICENSE }}
Source0: ${{ env.DEB_PKG_RENAMED }}
%description
${{ env.DESCRIPTION }}
%prep
ar x %{SOURCE0}
%build
rm -rf control.tar.gz
tar xvf data.tar.gz
%install
cp -fr usr/ %{buildroot}
%files
%{_bindir}/${{ env.PACKAGE_NAME }}
/usr/share/applications/${{ env.PACKAGE_NAME }}.desktop
/usr/share/icons/hicolor/**/*
EOF
cat ${{ env.BIN_PATH }}/rpm.spec
- uses: Antikythera/build-rpm@latest
id: build_rpm
with:
spec_file: ${{ env.BIN_PATH }}/rpm.spec
sources: |
${{ env.BIN_PATH }}/${{ env.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 }}
files: |
${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }}
${{ env.RPM_PKG_NAME }}