Skip to content

Commit c8b826e

Browse files
committed
Prefer curl and deprecate VERSION
1 parent d1a7140 commit c8b826e

File tree

4 files changed

+11
-45
lines changed

4 files changed

+11
-45
lines changed

.github/workflows/CI.yaml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,26 @@ jobs:
99
- name: Checkout
1010
uses: actions/checkout@v2
1111

12-
- name: Test swiftbox and update VERSION
12+
- name: Test swiftbox
1313
run: |
1414
chmod +x swiftbox.sh
1515
VERSION=`./swiftbox.sh version`
1616
echo "::set-env name=version::$VERSION"
1717
if [ $? -eq 0 ]
1818
then
19-
if [ $VERSION = `cat VERSION` ]
19+
if [ v$VERSION != `curl -fsSL https://api.github.com/repos/stevapple/swiftbox/releases/latest | jq .tag_name | sed "s/\"//g"` ]
2020
then
21-
exit 0
22-
else
23-
echo $VERSION > VERSION
2421
echo "::set-env name=updated::true"
25-
git config --global user.name "${{ github.actor }}"
26-
git config --global user.email "`curl https://api.github.com/users/${{ github.actor }} | jq .email`"
27-
git commit -m "Release $VERSION" -a
28-
git tag -a "v$VERSION" -m "Release $VERSION"
2922
fi
3023
else
3124
exit 1
3225
fi
33-
shell: bash
34-
35-
- name: Push to GitHub
36-
uses: ad-m/github-push-action@master
37-
if: ${{ env.updated }}
38-
with:
39-
github_token: ${{ secrets.GITHUB_TOKEN }}
4026
41-
- name: Release
42-
uses: softprops/action-gh-release@v1
27+
- name: Tag and release
28+
uses: avakar/tag-and-release@v1
4329
if: ${{ env.updated }}
4430
with:
45-
name: Release ${{ env.version }}
46-
files: swiftbox.sh
31+
release_name: Release ${{ env.version }}
4732
tag_name: v${{ env.version }}
4833
env:
4934
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

install.sh

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ fi
77

88
if [ "E`lsb_release -i --short`" = "EUbuntu" ]
99
then
10-
$SUDO_FLAG apt-get install wget jq -q=2
10+
$SUDO_FLAG apt-get install curl jq -q=2
1111
elif [[ `cat /etc/redhat-release` =~ "CentOS" || `cat /etc/redhat-release` =~ "Red Hat Enterprise Linux" ]]
1212
then
13-
$SUDO_FLAG yum install wget jq -q -y
13+
$SUDO_FLAG yum install curl jq -q -y
1414
else
1515
echo "This program only supports Ubuntu and CentOS (RHEL). "
1616
exit 255
1717
fi
1818

19-
LATEST_VERSION=`curl https://api.github.com/repos/stevapple/swiftbox/releases/latest | jq .tag_name | sed "s/v//" | sed "s/\"//g"`
19+
LATEST_VERSION=`curl -fsSL - https://api.github.com/repos/stevapple/swiftbox/releases/latest | jq .tag_name | sed "s/v//" | sed "s/\"//g"`
2020
INSTALL_DIR="/usr/bin"
2121
SWIFTBOX_VERSION=`$INSTALL_DIR/swiftbox version`
2222
if [ $? -eq 0 ]
@@ -27,30 +27,12 @@ else
2727
fi
2828

2929
if [ E$SWIFTBOX_VERSION = E$LATEST_VERSION ]
30-
then
31-
echo "Already installed the latest version $SWIFTBOX_VERSION at $INSTALL_DIR. "
32-
exit
33-
elif [[ $SWIFTBOX_VERSION > $LATEST_VERSION ]]
3430
then
3531
echo "Already installed the latest version $SWIFTBOX_VERSION at $INSTALL_DIR. "
3632
exit
3733
fi
3834

39-
$SUDO_FLAG wget -O "$INSTALL_DIR/swiftbox" "https://cdn.jsdelivr.net/gh/stevapple/swiftbox@$LATEST_VERSION/swiftbox.sh"
40-
WGET_RESULT=$?
41-
if [ $WGET_RESULT -eq 8 ]
42-
then
43-
echo "Error: It seems this release isn't created yet. "
44-
exit $WGET_RESULT
45-
elif [ $WGET_RESULT -ge 4 ]
46-
then
47-
echo "Error: Please check your Internet connection and proxy settings. "
48-
exit $WGET_RESULT
49-
elif [ $WGET_RESULT -ge 1 ]
50-
then
51-
echo "Error: Please check your wget config. "
52-
exit $WGET_RESULT
53-
fi
35+
$SUDO_FLAG curl -o "$INSTALL_DIR/swiftbox" "https://cdn.jsdelivr.net/gh/stevapple/swiftbox@$LATEST_VERSION/swiftbox.sh"
5436
$SUDO_FLAG chmod +x "$INSTALL_DIR/swiftbox"
5537
hash -r
5638
echo $SUCCESS_MESSAGE

swiftbox.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ else
1313
exit 255
1414
fi
1515

16-
SWIFTBOX_VERSION="0.5.5"
16+
SWIFTBOX_VERSION="0.6"
1717
INSTALL_DIR="/usr/bin"
1818

1919
get-latest() {
20-
curl https://api.github.com/repos/stevapple/swiftbox/releases/latest | jq .tag_name | sed "s/v//" | sed "s/\"//g"
20+
curl -fsSL https://api.github.com/repos/stevapple/swiftbox/releases/latest | jq .tag_name | sed "s/v//" | sed "s/\"//g"
2121
}
2222

2323
reinit-env() {

0 commit comments

Comments
 (0)