From e6c7da363574b12f9ad003ff9049206d8da22fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Saparelli?= Date: Sun, 27 Jun 2021 23:55:56 +1200 Subject: [PATCH] Add rpm support with cargo-generate-rpm --- .github/workflows/release.yml | 17 +++++++++++++++-- .gitignore | 3 +-- cli/Cargo.toml | 10 ++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94c1c2a..a459435 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.gitignore b/.gitignore index c2c87bf..257ac13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ target -*.tar.gz -*.zip +/watchexec-* diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 1b6f52a..3375a58 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -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 +]