Skip to content

Commit

Permalink
--version argument (AppImage only)
Browse files Browse the repository at this point in the history
  • Loading branch information
asherikov committed Nov 29, 2024
1 parent fdcd9d4 commit 5c49205
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
pull_request:
types: [opened, reopened]


env:
APT: sudo apt install -y --no-install-recommends

jobs:
ubuntu20:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -44,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ${APT} desktop-file-utils
- run: make appimage ARCH=x86_64 YQ_ARCH=amd64
- run: make appimage_deps
- run: make appimage ARCH=x86_64 YQ_ARCH=amd64 WSHANDLER_VERSION=1.1.1
- run: make appimage ARCH=aarch64 YQ_ARCH=arm64
- run: make test WSHANDLER=./build/appimage/wshandler-x86_64.AppImage
11 changes: 5 additions & 6 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ on:
tags:
- '**'

env:
APT: sudo apt install -y --no-install-recommends

jobs:
appimage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ${APT} desktop-file-utils
- run: make appimage ARCH=x86_64 YQ_ARCH=amd64 VERSION=${{ github.ref_name }}
- run: make appimage ARCH=aarch64 YQ_ARCH=arm64 VERSION=${{ github.ref_name }}
- run: make appimage_deps
- run: make appimage ARCH=x86_64 YQ_ARCH=amd64 WSHANDLER_VERSION=${{ github.ref_name }}
- run: make appimage ARCH=aarch64 YQ_ARCH=arm64 WSHANDLER_VERSION=${{ github.ref_name }}
- run: ./build/appimage/wshandler-x86_64.AppImage -r tests/update status
- uses: softprops/action-gh-release@v2
with:
files: |
build/appimage/wshandler*.AppImage
build/appimage/wshandler*.zsync
wshandler
wshandler
fail_on_unmatched_files: true
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,19 @@ appimage:
&& tar -xf 'yq_linux_${YQ_ARCH}.tar.gz' -O > "AppDir_${ARCH}/usr/bin/yq" \
&& chmod +x appimagetool-x86_64.AppImage
cp wshandler "${APPDIR}/usr/bin/"
test -z "${WSHANDLER_VERSION}" || sed -i -e "s/WSH_VERSION=/WSH_VERSION=${WSHANDLER_VERSION}/g" "${APPDIR}/usr/bin/wshandler"
cp appimage/AppRun "${APPDIR}/AppRun"
chmod +x "${APPDIR}/AppRun"
chmod +x "${APPDIR}/usr/bin/yq"
cp appimage/wshandler.png "${APPDIR}"
cp appimage/wshandler.desktop "${APPDIR}"
# --appimage-extract-and-run to avoid dependency on fuse in CI
cd build/appimage \
&& ./appimagetool-x86_64.AppImage AppDir_${ARCH} wshandler-${ARCH}.AppImage
&& ./appimagetool-x86_64.AppImage \
--updateinformation "gh-releases-zsync|asherikov|wshandler|latest|wshandler-${ARCH}.AppImage.zsync" \
AppDir_${ARCH} wshandler-${ARCH}.AppImage

appimage_deps:
sudo apt install -y --no-install-recommends desktop-file-utils zsync

.PHONY: appimage
15 changes: 15 additions & 0 deletions wshandler
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
set -e
set -o pipefail

WSH_VERSION=

help()
{
EXIT_CODE=${1:-"0"}
echo "Usage (default values are shown in curly braces):"
echo " wshandler [<COMMON_ARGS>] [<COMMAND_ARGS>] <COMMAND> <COMMAND_ARGS>"
if [ -n "${WSH_VERSION}" ]
then
echo " wshandler -v|--version"
fi
echo ""
echo "Notation:"
echo " <REQUIRED ARGUMENT>"
Expand Down Expand Up @@ -724,6 +729,16 @@ WSH_REPOLIST=
while [[ $# -gt 0 ]]
do
case $1 in
-v|--version)
if [ -n "${WSH_VERSION}" ]
then
echo "wshandler version: ${WSH_VERSION}"
exit
else
echo "wshandler version is unknown"
exit 50
fi;;

-y|--yq)
WSH_YQ_BINARY=$2
shift; shift;;
Expand Down

0 comments on commit 5c49205

Please sign in to comment.