diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 577b175..05f5424 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,36 +1,27 @@ name: release on: - push: - tags: - - '*' - - workflow_dispatch: + release: + types: [published] jobs: - release: - name: release - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: build - uses: sassman/rust-deb-builder@v1.57.0 - with: - target: x86_64-unknown-linux-musl - - name: package - run: | - cd "$GITHUB_WORKSPACE" - mkdir -p package - mkdir -p package/target/release - cp -v tmux-thumbs.sh tmux-thumbs.tmux package/ - cp -v target/x86_64-unknown-linux-musl/release/thumbs package/target/release - cp -v target/x86_64-unknown-linux-musl/release/tmux-thumbs package/target/release - tar czvf tmux-thumbs.x86_64-musl.tar.gz package/* - - name: create_release - uses: ncipollo/release-action@v1.9.0 - with: - artifactErrorsFailBuild: true - artifacts: "tmux-thumbs.x86_64-musl.tar.gz" + release: + name: release ${{ matrix.target }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-linux-musl + archive: tar.gz tar.xz + - target: x86_64-apple-darwin + archive: zip + steps: + - uses: actions/checkout@master + - name: Compile and release + uses: rust-build/rust-build.action@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RUSTTARGET: ${{ matrix.target }} + EXTRA_FILES: "tmux-thumbs.sh tmux-thumbs.tmux tmux-thumbs-install.sh" + ARCHIVE_TYPES: ${{ matrix.archive }} diff --git a/Cargo.lock b/Cargo.lock index 545030c..9e85f21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -155,7 +155,7 @@ dependencies = [ [[package]] name = "thumbs" -version = "0.6.1" +version = "0.7.0" dependencies = [ "base64", "clap", diff --git a/Cargo.toml b/Cargo.toml index 3b25347..c34e73e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thumbs" -version = "0.6.1" +version = "0.7.0" authors = ["Ferran Basora "] edition = "2018" description = "A lightning fast version copy/pasting like vimium/vimperator" diff --git a/README.md b/README.md index 851d6a9..5812ed9 100644 --- a/README.md +++ b/README.md @@ -433,7 +433,7 @@ cargo install thumbs And those are all available options: ``` -thumbs 0.6.0 +thumbs 0.7.0 A lightning fast version copy/pasting like vimium/vimperator USAGE: diff --git a/tmux-thumbs.sh b/tmux-thumbs.sh index 165841d..6c1b89c 100755 --- a/tmux-thumbs.sh +++ b/tmux-thumbs.sh @@ -1,9 +1,16 @@ #!/usr/bin/env bash set -Eeu -o pipefail +# Setup env variables to be compatible with compiled and bundled installations CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -BINARY="${CURRENT_DIR}/target/release/thumbs" +if [ -d .git ]; then + RELEASE_DIR="${CURRENT_DIR}/target/release" +else + RELEASE_DIR=${CURRENT_DIR} +fi + +BINARY="${RELEASE_DIR}/thumbs" if [ ! -f "$BINARY" ]; then tmux split-window "cd ${CURRENT_DIR} && bash ./tmux-thumbs-install.sh" @@ -43,4 +50,4 @@ add-param upcase-command string add-param multi-command string add-param osc52 boolean -"${CURRENT_DIR}/target/release/tmux-thumbs" "${PARAMS[@]}" || true +"${RELEASE_DIR}/tmux-thumbs" "${PARAMS[@]}" || true