diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index d850d17..17c9962 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -13,17 +13,19 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - os: [linux] + os: [linux, darwin] arch: [amd64, arm64] steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v7 with: go-version-file: 'go.mod' - - uses: ruby/setup-ruby@v1.146.0 + - uses: ruby/setup-ruby@v1 + if: ${{ matrix.os == 'linux' }} with: ruby-version: '3.1' - run: gem install fpm + if: ${{ matrix.os == 'linux' }} - name: Set version run: sed -i "s/VERSION = \"[^\"]*\"/VERSION = \"${{ inputs.version }}\"/" quickhook.go - name: Build @@ -54,12 +56,15 @@ jobs: --version ${{ inputs.version }} \ --architecture ${{ matrix.arch }} \ --chdir build . - # - name: Copy binaries - # if: ${{ matrix.os == 'darwin' }} - # run: | - # cp build/usr/bin/quickhook quickhook-${{ matrix.os }}-${{ matrix.arch }} - - uses: actions/upload-artifact@v3 + # Binary at the archive root so tool managers (e.g. mise's github + # backend) find the executable without path overrides. + - name: Package tarballs + run: | + tar -czf quickhook-${{ inputs.version }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz -C build/usr/bin quickhook + - uses: actions/upload-artifact@v4 with: + name: release-${{ matrix.os }}-${{ matrix.arch }} path: | *.deb *.rpm + *.tar.gz diff --git a/.github/workflows/release-verify-deb-ubuntu.yml b/.github/workflows/release-verify-deb-ubuntu.yml index 45d7a8f..7b9c03e 100644 --- a/.github/workflows/release-verify-deb-ubuntu.yml +++ b/.github/workflows/release-verify-deb-ubuntu.yml @@ -14,7 +14,8 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - name: artifact + pattern: release-linux-* + merge-multiple: true - run: | dpkg --info quickhook-${{ inputs.version }}-linux-amd64.deb dpkg --contents quickhook-${{ inputs.version }}-linux-amd64.deb diff --git a/.github/workflows/release-verify-rpm-rhel.yml b/.github/workflows/release-verify-rpm-rhel.yml index 58dc333..822d368 100644 --- a/.github/workflows/release-verify-rpm-rhel.yml +++ b/.github/workflows/release-verify-rpm-rhel.yml @@ -15,7 +15,8 @@ jobs: steps: - uses: actions/download-artifact@v4 with: - name: artifact + pattern: release-linux-* + merge-multiple: true - run: | rpm --package quickhook-${{ inputs.version }}-linux-amd64.rpm --query --info rpm --package quickhook-${{ inputs.version }}-linux-amd64.rpm --query --list diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4ddca70..584b158 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,18 +20,41 @@ jobs: - id: version run: | echo "${{ inputs.version }}" | sed -E "s/^v?/version=/" >> $GITHUB_OUTPUT - build-linux: + build: uses: ./.github/workflows/release-build.yml needs: version with: version: ${{ needs.version.outputs.version }} verify-deb-ubuntu: uses: ./.github/workflows/release-verify-deb-ubuntu.yml - needs: [version, build-linux] + needs: [version, build] with: version: ${{ needs.version.outputs.version }} verify-rpm-rhel: uses: ./.github/workflows/release-verify-rpm-rhel.yml - needs: [version, build-linux] + needs: [version, build] with: version: ${{ needs.version.outputs.version }} + # Draft a release with all verified assets attached; publishing stays a + # human step. Skipped on non-main refs so test dispatches of this workflow + # only build and verify. + publish: + runs-on: ubuntu-latest + if: github.ref_name == github.event.repository.default_branch + needs: [version, verify-deb-ubuntu, verify-rpm-rhel] + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + pattern: release-* + merge-multiple: true + - name: Draft release with assets + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "v${{ needs.version.outputs.version }}" \ + --repo "${{ github.repository }}" \ + --draft \ + --generate-notes \ + *.deb *.rpm *.tar.gz diff --git a/README.md b/README.md index fdc4143..165be22 100644 --- a/README.md +++ b/README.md @@ -62,18 +62,29 @@ $ brew install quickhook /opt/homebrew/Cellar/quickhook/1.6.2: 6 files, 3.8MB, built in 5 seconds ``` -### Linux +### Binary downloads -Installable debs and RPMs are available for the [latest release](https://github.com/dirk/quickhook/releases/latest). +Tarballs for Linux and macOS, plus installable debs and RPMs for Linux, are available for the [latest release](https://github.com/dirk/quickhook/releases/latest). Assets are named `quickhook---` with `linux`/`darwin` and `amd64`/`arm64`. (Tarballs ship starting with the first release after v1.6.2; debs and RPMs are already available.) ```sh +# Installing a tarball (the binary sits at the archive root); +# substitute the latest release's version for +curl -LO https://github.com/dirk/quickhook/releases/download/v/quickhook--darwin-arm64.tar.gz +tar -xzf quickhook--darwin-arm64.tar.gz quickhook # then move it onto your $PATH + # Installing a .deb -wget https://github.com/dirk/quickhook/releases/download/v1.5.0/quickhook-1.5.0-amd64.deb -sudo apt install ./quickhook-1.5.0-amd64.deb +curl -LO https://github.com/dirk/quickhook/releases/download/v1.6.2/quickhook-1.6.2-linux-amd64.deb +sudo apt install ./quickhook-1.6.2-linux-amd64.deb # Installing a .rpm -wget https://github.com/dirk/quickhook/releases/download/v1.5.0/quickhook-1.5.0-amd64.rpm -sudo rpm --install quickhook-1.5.0-amd64.rpm +curl -LO https://github.com/dirk/quickhook/releases/download/v1.6.2/quickhook-1.6.2-linux-amd64.rpm +sudo rpm --install quickhook-1.6.2-linux-amd64.rpm +``` + +Or let [mise](https://mise.jdx.dev) fetch the right tarball for your platform: + +```sh +$ mise use --global github:dirk/quickhook ``` ## Usage