Add rpm support with cargo-generate-rpm

This commit is contained in:
Félix Saparelli 2021-06-27 23:55:56 +12:00
parent 1eaaf7e844
commit e6c7da3635
3 changed files with 26 additions and 4 deletions

View File

@ -87,6 +87,9 @@ jobs:
- name: Install cargo-deb
run: cargo install cargo-deb --version 1.30.0
- name: Install cargo-generate-rpm
run: cargo install cargo-generate-rpm --version 0.4.0
- uses: actions-rs/toolchain@v1
with:
target: ${{ matrix.target }}
@ -126,8 +129,8 @@ jobs:
dst="watchexec-${version}-${{ matrix.target }}"
mkdir "$dst"
strip "$bin" || true
mv "$bin" "$dst/"
mv cli/README.md LICENSE completions doc/watchexec.1{,.html} "$dst/"
cp "$bin" "$dst/"
cp cli/README.md LICENSE completions doc/{logo.svg,watchexec.1{,.html}} "$dst/"
- name: Archive (tar)
if: '! startsWith(matrix.name, ''windows-'')'
@ -145,6 +148,16 @@ jobs:
version=$(cat VERSION)
dst="watchexec-${version}-${{ matrix.target }}"
cargo deb -p watchexec-cli --target ${{ matrix.target }} --output "$dst.deb"
- name: Archive (rpm)
if: startsWith(matrix.name, 'linux-')
shell: bash
run: |
set -euxo pipefail
shopt -s globstar
version=$(cat VERSION)
dst="watchexec-${version}-${{ matrix.target }}"
cargo generate-rpm -p cli --target "${{ matrix.target }}" --target "target/${{ matrix.target }}"
mv target/**/*.rpm "$dst.rpm"
- name: Archive (zip)
if: startsWith(matrix.name, 'windows-')
shell: bash

3
.gitignore vendored
View File

@ -1,3 +1,2 @@
target
*.tar.gz
*.zip
/watchexec-*

View File

@ -63,3 +63,13 @@ assets = [
["../doc/logo.svg", "usr/share/icons/hicolor/scalable/apps/watchexec.svg", "644"],
]
[package.metadata.generate-rpm]
assets = [
{ source = "target/release/watchexec", dest = "/usr/bin/", mode = "755" },
{ source = "cli/README.md", dest = "/usr/share/doc/watchexec/README", mode = "644", doc = true },
{ source = "doc/watchexec.1.html", dest = "/usr/share/doc/watchexec/watchexec.1.html", mode = "644", doc = true },
{ source = "doc/watchexec.1", dest = "/usr/share/man/man1/watchexec.1.html", mode = "644" },
{ source = "completions/zsh", dest = "/usr/share/zsh/site-functions/_watchexec", mode = "644" },
{ source = "doc/logo.svg", dest = "/usr/share/icons/hicolor/scalable/apps/watchexec.svg", mode = "644" },
# set conf = true for config file when that lands
]