Skip to content

Commit 5c49205

Browse files
committed
--version argument (AppImage only)
1 parent fdcd9d4 commit 5c49205

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

.github/workflows/master.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ on:
55
pull_request:
66
types: [opened, reopened]
77

8-
9-
env:
10-
APT: sudo apt install -y --no-install-recommends
11-
128
jobs:
139
ubuntu20:
1410
runs-on: ubuntu-20.04
@@ -44,7 +40,7 @@ jobs:
4440
runs-on: ubuntu-latest
4541
steps:
4642
- uses: actions/checkout@v4
47-
- run: ${APT} desktop-file-utils
48-
- run: make appimage ARCH=x86_64 YQ_ARCH=amd64
43+
- run: make appimage_deps
44+
- run: make appimage ARCH=x86_64 YQ_ARCH=amd64 WSHANDLER_VERSION=1.1.1
4945
- run: make appimage ARCH=aarch64 YQ_ARCH=arm64
5046
- run: make test WSHANDLER=./build/appimage/wshandler-x86_64.AppImage

.github/workflows/tag.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@ on:
33
tags:
44
- '**'
55

6-
env:
7-
APT: sudo apt install -y --no-install-recommends
8-
96
jobs:
107
appimage:
118
runs-on: ubuntu-latest
129
steps:
1310
- uses: actions/checkout@v4
14-
- run: ${APT} desktop-file-utils
15-
- run: make appimage ARCH=x86_64 YQ_ARCH=amd64 VERSION=${{ github.ref_name }}
16-
- run: make appimage ARCH=aarch64 YQ_ARCH=arm64 VERSION=${{ github.ref_name }}
11+
- run: make appimage_deps
12+
- run: make appimage ARCH=x86_64 YQ_ARCH=amd64 WSHANDLER_VERSION=${{ github.ref_name }}
13+
- run: make appimage ARCH=aarch64 YQ_ARCH=arm64 WSHANDLER_VERSION=${{ github.ref_name }}
1714
- run: ./build/appimage/wshandler-x86_64.AppImage -r tests/update status
1815
- uses: softprops/action-gh-release@v2
1916
with:
2017
files: |
2118
build/appimage/wshandler*.AppImage
19+
build/appimage/wshandler*.zsync
20+
wshandler
2221
wshandler
2322
fail_on_unmatched_files: true

Makefile

+7-1
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,19 @@ appimage:
120120
&& tar -xf 'yq_linux_${YQ_ARCH}.tar.gz' -O > "AppDir_${ARCH}/usr/bin/yq" \
121121
&& chmod +x appimagetool-x86_64.AppImage
122122
cp wshandler "${APPDIR}/usr/bin/"
123+
test -z "${WSHANDLER_VERSION}" || sed -i -e "s/WSH_VERSION=/WSH_VERSION=${WSHANDLER_VERSION}/g" "${APPDIR}/usr/bin/wshandler"
123124
cp appimage/AppRun "${APPDIR}/AppRun"
124125
chmod +x "${APPDIR}/AppRun"
125126
chmod +x "${APPDIR}/usr/bin/yq"
126127
cp appimage/wshandler.png "${APPDIR}"
127128
cp appimage/wshandler.desktop "${APPDIR}"
128129
# --appimage-extract-and-run to avoid dependency on fuse in CI
129130
cd build/appimage \
130-
&& ./appimagetool-x86_64.AppImage AppDir_${ARCH} wshandler-${ARCH}.AppImage
131+
&& ./appimagetool-x86_64.AppImage \
132+
--updateinformation "gh-releases-zsync|asherikov|wshandler|latest|wshandler-${ARCH}.AppImage.zsync" \
133+
AppDir_${ARCH} wshandler-${ARCH}.AppImage
134+
135+
appimage_deps:
136+
sudo apt install -y --no-install-recommends desktop-file-utils zsync
131137

132138
.PHONY: appimage

wshandler

+15
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
set -e
66
set -o pipefail
77

8+
WSH_VERSION=
89

910
help()
1011
{
1112
EXIT_CODE=${1:-"0"}
1213
echo "Usage (default values are shown in curly braces):"
1314
echo " wshandler [<COMMON_ARGS>] [<COMMAND_ARGS>] <COMMAND> <COMMAND_ARGS>"
15+
if [ -n "${WSH_VERSION}" ]
16+
then
17+
echo " wshandler -v|--version"
18+
fi
1419
echo ""
1520
echo "Notation:"
1621
echo " <REQUIRED ARGUMENT>"
@@ -724,6 +729,16 @@ WSH_REPOLIST=
724729
while [[ $# -gt 0 ]]
725730
do
726731
case $1 in
732+
-v|--version)
733+
if [ -n "${WSH_VERSION}" ]
734+
then
735+
echo "wshandler version: ${WSH_VERSION}"
736+
exit
737+
else
738+
echo "wshandler version is unknown"
739+
exit 50
740+
fi;;
741+
727742
-y|--yq)
728743
WSH_YQ_BINARY=$2
729744
shift; shift;;

0 commit comments

Comments
 (0)