commit ab2df90d473319600f867e1b79890b2bcee5aa9c Spenser Truex <truex@equwal.com> 2026-09-20 22:29:48 -0700 Build the installer and the image on GitHub Actions The workflow runs make check on Linux and macOS, and shellcheck on contrib. It makes the Windows installer and the macOS image. For a tag vVERSION, it also makes a GitHub release with them and with the tarball of make dist.
.github/workflows/build.yml | 90 +++++++++++++++++++++++++++++++++++++++++++++ README | 8 ++++ 2 files changed, 98 insertions(+)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7a4038f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,90 @@ +# Test bm on Linux and macOS, and make the Windows installer and the macOS +# image. For a tag vVERSION, also make a release with them. +name: build + +on: + push: + pull_request: + +permissions: + contents: read + +jobs: + check: + name: make check (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - run: make check + - name: shellcheck contrib + if: runner.os == 'Linux' + run: >- + shellcheck -s sh + contrib/windows/fzf contrib/windows/sbm.sh contrib/windows/sbm-setup + contrib/windows/build-installer.sh + contrib/macos/sbm contrib/macos/sbm-run contrib/macos/build-dmg.sh + + windows: + name: Windows installer + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: sudo apt-get update && sudo apt-get install -y nsis + - run: sh contrib/windows/build-installer.sh + - uses: actions/upload-artifact@v4 + with: + name: windows + path: sbm-*-setup.exe + if-no-files-found: error + + macos: + name: macOS image + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - run: sh contrib/macos/build-dmg.sh + - name: Check the image + run: | + dmg=$(echo sbm-*.dmg) + hdiutil verify "$dmg" + mnt=$(mktemp -d) + hdiutil attach -nobrowse -readonly -mountpoint "$mnt" "$dmg" + app=$mnt/sbm.app + plutil -lint "$app/Contents/Info.plist" + codesign --verify --deep --strict "$app" + lipo -archs "$app/Contents/Resources/bin/fzf" + "$app/Contents/Resources/bin/fzf" --version + printf 'https://a.example\tA\tt\n' > "$RUNNER_TEMP/bookmarks" + test "$(BOOKMARKS=$RUNNER_TEMP/bookmarks "$app/Contents/Resources/sbm-run" --list | cut -f1)" = https://a.example + hdiutil detach "$mnt" + - uses: actions/upload-artifact@v4 + with: + name: macos + path: sbm-*.dmg + if-no-files-found: error + + release: + name: Release + if: startsWith(github.ref, 'refs/tags/v') + needs: [check, windows, macos] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Check that the tag is v and the VERSION of config.mk + run: test "$GITHUB_REF_NAME" = "v$(sed -n 's/^VERSION=//p' config.mk)" + - run: make dist + - uses: actions/download-artifact@v4 + with: + merge-multiple: true + - name: Make the release + env: + GH_TOKEN: ${{ github.token }} + run: >- + gh release create "$GITHUB_REF_NAME" --title "sbm ${GITHUB_REF_NAME#v}" + --generate-notes sbm-*.tar.gz sbm-*-setup.exe sbm-*.dmg diff --git a/README b/README index 119d66f..e273451 100644 --- a/README +++ b/README @@ -45,6 +45,9 @@ Edit TOOLS in config.mk to choose what gets installed, then make install # to /usr/local/bin make PREFIX="$HOME/.local" install +Each release on GitHub also has an installer for Windows and a portable app +for macOS. See Windows and macOS below. + == Setup == Nothing is required. Bookmarks are kept in ~/.local/share/sbm/bookmarks ($XDG_DATA_HOME is honoured) and the file is created on first use. @@ -260,6 +263,11 @@ runs shellcheck, when installed, and test/run.sh, under sh. Run the tests under another shell with SBM_SH=dash sh test/run.sh. They script dmenu, fzf and curl, so they need no display and no network. +== Releases == +Push a tag vVERSION, with VERSION from config.mk. GitHub Actions then runs +make check on Linux and macOS, and makes the installer and the image. It +makes a release with them and with the tarball of make dist. + == Credits == Some ideas taken from Karl Voit: https://karl-voit.at/2022/01/29/How-to-Use-Tags/