Skip to content

Commit

Permalink
add arch & rpm packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Dec 9, 2023
1 parent bce199a commit 25067d5
Show file tree
Hide file tree
Showing 8 changed files with 364 additions and 241 deletions.
187 changes: 138 additions & 49 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,89 +7,178 @@ on:
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
EMAIL: [email protected]
ARCH: x86_64
jobs:
create-release:
setup:
runs-on: ubuntu-latest
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create-release.outputs.result }}

arch: ${{ env.ARCH }}
email: ${{ env.EMAIL }}
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/
steps:
- uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 18
- name: get version
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
- name: create release
id: create-release
uses: actions/github-script@v6
with:
script: |
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `clippy-v${process.env.PACKAGE_VERSION}`,
name: `Clippy v${process.env.PACKAGE_VERSION}`,
body: 'Take a look at the assets to download and install this app.',
draft: true,
prerelease: false
})
return data.id
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
# - uses: dev-drprasad/[email protected]
# with:
# tag_name: ${{ steps.get-package.outputs.version }}
# github_token: ${{ secrets.GITHUB_TOKEN }}

build-tauri:
needs: create-release
needs: [setup]
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]

runs-on: ${{ matrix.platform }}
env:
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@v3

- uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
- name: install Rust stable
node-version: 20

- 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 libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf libxcb-shape0-dev libxcb-xfixes0-dev libxdo-dev
sudo apt-get install -y openssl
sudo apt-get install -y sudo
sudo apt-get install -y make
sudo apt-get install -y alien
sudo apt-get install -y libgtk-3-dev
sudo apt-get install -y libwebkit2gtk-4.0-dev
sudo apt-get install -y libappindicator3-dev
sudo apt-get install -y librsvg2-dev
sudo apt-get install -y patchelf
sudo apt-get install -y libxcb-shape0-dev
sudo apt-get install -y libxcb-xfixes0-dev
sudo apt-get install -y libxdo-dev
- name: install frontend dependencies
run: yarn install

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
tagName: ${{ env.PACKAGE_VERSION }}
releaseName: ${{ env.PACKAGE_VERSION }}
releaseDraft: false
prerelease: false

publish-release:
permissions:
contents: write
runs-on: ubuntu-latest
needs: [create-release, build-tauri]

steps:
- name: publish release
id: publish-release
uses: actions/github-script@v6
env:
release_id: ${{ needs.create-release.outputs.release_id }}
- 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.PACKAGE_VERSION }}
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
# 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}')')
pkgrel=1
depends=('libappindicator-gtk3' 'webkit2gtk' 'gtk3')
pkgdesc='${{ env.DESCRIPTION }}'
arch=('${{ env.ARCH }}')
url="https://github.com/${{ github.repository }}"
license=('${{ env.LICENSE }}')
source=("\$url/releases/download/${{ env.PACKAGE_VERSION }}/${{ 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: create rpm package (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update && sudo apt-get install -y sudo make alien
alien -r -k --scripts --target=x86_64 ${{ env.DEB_PKG_PATH }}${{ env.DEB_PKG_NAME }}
- name: create checksums (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
- name: upload arch && rpm release (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
uses: softprops/action-gh-release@v1
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.release_id,
draft: false,
prerelease: false
})
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ env.PACKAGE_VERSION }}
files: |
${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }}
${{ env.BIN_PATH }}/${{ env.ARCH_PKG_NAME }}.md5sum
${{ env.DEB_PKG_NAME }}.md5sum
${{ env.RPM_PKG_NAME }}
${{ env.RPM_PKG_NAME }}.md5sum
26 changes: 14 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"name": "clippy",
"version": "1.2.0",
"version": "1.2.1",
"description": "Clipboard Manager built with Rust & Typescript",
"license": "MIT",
"private": true,
"scripts": {
"start": "vite",
Expand All @@ -23,24 +25,24 @@
"@tauri-apps/api": "^1.5.1",
"dayjs": "^1.11.10",
"solid-icons": "^1.1.0",
"solid-js": "^1.8.6",
"solid-js": "^1.8.7",
"tauri-plugin-autostart-api": "https://github.com/tauri-apps/tauri-plugin-autostart"
},
"devDependencies": {
"@kobalte/tailwindcss": "^0.9.0",
"@tauri-apps/cli": "^1.5.6",
"@types/node": "^20.10.0",
"@tauri-apps/cli": "^1.5.7",
"@types/node": "^20.10.4",
"autoprefixer": "^10.4.16",
"husky": "^8.0.3",
"lint-staged": "^15.1.0",
"postcss": "^8.4.31",
"lint-staged": "^15.2.0",
"postcss": "^8.4.32",
"prettier": "^3.1.0",
"prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-tailwindcss": "^0.5.7",
"tailwindcss": "^3.3.5",
"typescript": "^5.3.2",
"vite": "^5.0.2",
"prettier-plugin-tailwindcss": "^0.5.9",
"tailwindcss": "^3.3.6",
"typescript": "^5.3.3",
"vite": "^5.0.7",
"vite-plugin-checker": "^0.6.2",
"vite-plugin-solid": "^2.7.2"
"vite-plugin-solid": "^2.8.0"
}
}
}
Loading

0 comments on commit 25067d5

Please sign in to comment.