Skip to content

Commit

Permalink
Merge pull request #215 from xrelkd/ci/rpm
Browse files Browse the repository at this point in the history
Support creating package for Fedora
  • Loading branch information
xrelkd authored Dec 18, 2023
2 parents db041f9 + bf98035 commit 41b80fd
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 7 deletions.
46 changes: 40 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
run: ./dev-support/bin/create-package
shell: bash

- name: Prepare Debian Package
- name: Prepare DEB Package
env:
TARGET: ${{ matrix.target }}
REF: ${{ github.ref }}
Expand All @@ -98,18 +98,42 @@ jobs:
if: ${{ matrix.arch == 'amd64' }}
shell: bash

- name: Create Debian Package
id: debian-package
- name: Create DEB Package
id: deb-package
uses: jiro4989/build-deb-action@v3
if: ${{ matrix.arch == 'amd64' }}
with:
package: ${{ env.PACKAGE_NAME }}
package_root: debian
package_root: .debpkg
maintainer: ${{ env.MAINTAINER }}
version: ${{ github.ref }}
arch: ${{ matrix.arch }}
desc: ${{ env.PACKAGE_DESCRIPTION }}

- name: Prepare RPM Package
env:
TARGET: ${{ matrix.target }}
REF: ${{ github.ref }}
OS: ${{ matrix.os }}
ARCH: ${{ matrix.arch }}
TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }}
run: ./dev-support/bin/prepare-rpm-package
if: ${{ matrix.arch == 'amd64' }}
shell: bash

- name: Create RPM Package
id: rpm-package
uses: jiro4989/build-rpm-action@v2
if: ${{ matrix.arch == 'amd64' }}
with:
summary: ${{ env.PACKAGE_DESCRIPTION }}
package: ${{ env.PACKAGE_NAME }}
package_root: .rpmpkg
maintainer: ${{ env.MAINTAINER }}
version: ${{ github.ref }}
arch: "x86_64"
desc: ${{ env.PACKAGE_DESCRIPTION }}

- name: Publish Package Archive
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
Expand All @@ -120,12 +144,22 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Debian Package
- name: Publish DEB Package
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.arch == 'amd64' }}
with:
draft: false
files: ${{ steps.deb-package.outputs.file_name }}
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish RPM Package
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.arch == 'amd64' }}
with:
draft: false
files: ${{ steps.debian-package.outputs.file_name }}
files: ${{ steps.rpm-package.outputs.file_name }}
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion dev-support/bin/prepare-deb-package
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euxo pipefail

PACKAGE_NAME="clipcat"
VERSION=$(basename "$REF")
DIST=$(pwd)/debian
DIST=$(pwd)/.debpkg

echo "Packaging $PACKAGE_NAME $VERSION for $TARGET..."

Expand Down
30 changes: 30 additions & 0 deletions dev-support/bin/prepare-rpm-package
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -euxo pipefail

PACKAGE_NAME="clipcat"
VERSION=$(basename "$REF")
DIST=$(pwd)/.rpmpkg

echo "Packaging $PACKAGE_NAME $VERSION for $TARGET..."

echo "Building $PACKAGE_NAME..."
RUSTFLAGS="$TARGET_RUSTFLAGS" cargo build --target "$TARGET" --release

mkdir -p "$DIST/usr/bin"
mkdir -p "$DIST/usr/share/bash-completion/completions/"
mkdir -p "$DIST/usr/share/zsh/site-functions/"
mkdir -p "$DIST/usr/share/fish/vendor_completions.d/"

for cmd in clipcatd clipcatctl clipcat-menu clipcat-notify; do
cp -v "target/$TARGET/release/${cmd}" "$DIST/usr/bin"

"$DIST/usr/bin/${cmd}" completions bash >"$DIST/usr/share/bash-completion/completions/${cmd}"
chmod 644 "$DIST/usr/share/bash-completion/completions/${cmd}"

"$DIST/usr/bin/${cmd}" completions zsh >"$DIST/usr/share/zsh/site-functions/_${cmd}"
chmod 644 "$DIST/usr/share/zsh/site-functions/_${cmd}"

"$DIST/usr/bin/${cmd}" completions fish >"$DIST/usr/share/fish/vendor_completions.d/${cmd}.fish"
chmod 644 "$DIST/usr/share/fish/vendor_completions.d/${cmd}.fish"
done

0 comments on commit 41b80fd

Please sign in to comment.