Merge branch 'docs/website'

This commit is contained in:
Félix Saparelli 2021-07-22 00:18:13 +12:00
commit 18fdbbcfea
6 changed files with 135 additions and 32 deletions

2
.github/workflows/release.pub vendored Normal file
View File

@ -0,0 +1,2 @@
untrusted comment: minisign public key: 595C0E790D9AC9D3
RWTTyZoNeQ5cWcHG3r9eeUw7Ec83iuvBM4X5NLVYzF/mP6ZCNvmpHZ3R

View File

@ -1,6 +1,7 @@
name: CLI Release
on:
workflow_dispatch:
push:
tags:
- "cli-v*.*.*"
@ -83,18 +84,40 @@ jobs:
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
- 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 }}
toolchain: stable
profile: minimal
override: true
- uses: actions-rs/cargo@v1
name: Build
with:
use-cross: ${{ matrix.cross }}
command: build
args: --package watchexec-cli --release --locked --target ${{ matrix.target }}
- name: Extract version
shell: bash
run: |
set -euxo pipefail
version=$(grep -m1 -F 'version =' cli/Cargo.toml | cut -d\" -f2)
if [[ -z "$version" ]]; then
echo "Error: no version :("
exit 1
fi
echo "$version" > VERSION
- name: Package
shell: bash
run: |
@ -102,18 +125,19 @@ jobs:
ext=""
[[ "${{ matrix.name }}" == windows-* ]] && ext=".exe"
bin="target/${{ matrix.target }}/release/watchexec${ext}"
version=$(grep -oE '[0-9.]+' <<< "${{ github.ref }}")
version=$(cat VERSION)
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-'')'
shell: bash
run: |
set -euxo pipefail
version=$(grep -oE '[0-9.]+' <<< "${{ github.ref }}")
version=$(cat VERSION)
dst="watchexec-${version}-${{ matrix.target }}"
tar cavf "$dst.tar.xz" "$dst"
- name: Archive (deb)
@ -121,43 +145,96 @@ jobs:
shell: bash
run: |
set -euxo pipefail
version=$(grep -oE '[0-9.]+' <<< "${{ github.ref }}")
version=$(cat VERSION)
dst="watchexec-${version}-${{ matrix.target }}"
mkdir -p "deb/$dst"
cd "deb/$dst"
mkdir -p DEBIAN usr/{bin,share/{man/man1,doc/watchexec,zsh/site-functions}}
cp "../../$dst/watchexec" usr/bin/
cp "../../$dst/watchexec.1" usr/share/man/man1/
cp "../../$dst/watchexec.1.html" usr/share/doc/watchexec/
cp "../../$dst/completions/zsh" usr/share/zsh/site-functions/_watchexec
cat <<-CONTROL > DEBIAN/control
Package: watchexec
Version: ${version}
Architecture: $(echo "${{ matrix.name }}" | cut -d- -f2)
Maintainer: Félix Saparelli <aur@passcod.name>
Installed-Size: $(du -d1 usr | tail -n1 | cut -d\t -f1)
Homepage: https://github.com/watchexec/watchexec
Description: Executes commands in response to file modifications.
Software development often involves running the same commands over and over. Boring!
Watchexec is a simple, standalone tool that watches a path and runs a command whenever it detects modifications.
CONTROL
cd ..
fakeroot dpkg -b "$dst"
mv "$dst.deb" ../
cd ..
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
run: |
set -euxo pipefail
version=$(grep -oE '[0-9.]+' <<< "${{ github.ref }}")
version=$(cat VERSION)
dst="watchexec-${version}-${{ matrix.target }}"
7z a "$dst.zip" "$dst"
- uses: actions/upload-artifact@v2
with:
name: builds
retention-days: 1
path: |
watchexec-*.tar.xz
watchexec-*.tar.zst
watchexec-*.deb
watchexec-*.rpm
watchexec-*.zip
sign:
needs: build
name: Checksum and sign
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.cargo/bin
key: sign-tools-${{ hashFiles('.github/workflows/release.yml') }}
- name: Install rsign2
run: cargo install rsign2 --version 0.5.7
- name: Install b3sum
run: cargo install b3sum --version 0.3.7
- uses: actions/download-artifact@v2
with:
name: builds
- name: Checksums with BLAKE3
run: b3sum watchexec-* | tee B3SUMS
- name: Checksums with SHA512
run: sha512sum watchexec-* | tee SHA512SUMS
- name: Sign checksums
shell: bash
env:
RELEASE_KEY: ${{ secrets.RELEASE_KEY }}
run: |
set -u
echo "$RELEASE_KEY" > release.key
set -x
version=$(grep -m1 -F 'version =' cli/Cargo.toml | cut -d\" -f2)
for algo in B3 SHA512; do
echo | rsign sign \
-p .github/workflows/release.pub \
-s release.key \
-t "watchexec v$version signed with automated key" \
-c 'see website for signing information' \
-x "${algo}SUMS.auto.minisig" \
"${algo}SUMS"
done
rm release.key
cat {B3,SHA512}SUMS.auto.minisig
- uses: softprops/action-gh-release@v1
with:
files: |
watchexec-*.tar.xz
watchexec-*.tar.zst
watchexec-*.deb
watchexec-*.rpm
watchexec-*.zip
*SUMS*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

3
.gitignore vendored
View File

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

View File

@ -50,7 +50,7 @@ All options in detail: [in the CLI README](./cli/#installation).
## Extend
- [watchexec library](./lib/): to create more specialised watchexec-powered tools! such as:
- [cargo watch](https://github.com/passcod/cargo-watch): for Rust/Cargo projects.
- [cargo watch](https://github.com/watchexec/cargo-watch): for Rust/Cargo projects.
- [clearscreen](https://github.com/watchexec/clearscreen): to clear the (terminal) screen on every platform.
- [command group](https://github.com/watchexec/command-group): to run commands in process groups.
- [notify](https://github.com/notify-rs/notify): to respond to file modifications (third-party).

View File

@ -48,3 +48,28 @@ pkg-fmt = "txz"
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-url = "{ repo }/releases/download/cli-v{ version }/watchexec-{ version }-{ target }.zip"
pkg-fmt = "zip"
[package.metadata.deb]
maintainer = "Félix Saparelli <felix@passcod.name>"
license-file = ["../LICENSE", "0"]
section = "utility"
# conf-files = [] # look me up when config file lands
assets = [
["../target/release/watchexec", "usr/bin/", "755"],
["README.md", "usr/share/doc/watchexec/README", "644"],
["../doc/watchexec.1.html", "usr/share/doc/watchexec/watchexec.1.html", "644"],
["../doc/watchexec.1", "usr/share/man/man1/watchexec.1.html", "644"],
["../completions/zsh", "usr/share/zsh/site-functions/_watchexec", "644"],
["../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
]

View File

@ -6,7 +6,7 @@
# Watchexec library
_The library which powers [Watchexec CLI](https://github.com/watchexec/watchexec) and other tools._
_The library which powers [Watchexec CLI](https://watchexec.github.io) and other tools._
- **[API documentation][docs]**.
- Licensed under [Apache 2.0][license].