Compare commits

..

No commits in common. "e399af1f1f6126ee24057c35bbc393f98a7611c3" and "dd3b9c9b9c5f0e0430e1d923a88bdfaed1e4cb38" have entirely different histories.

3 changed files with 34 additions and 169 deletions

View File

@ -8,30 +8,20 @@ on:
jobs:
release:
name: 'Build, package and release to GitHub'
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
include:
- platform: ubuntu-18.04
GOOS: linux
GOARCH: amd64
CC: gcc
- platform: ubuntu-18.04
package: gcc-aarch64-linux-gnu
GOOS: linux
GOARCH: arm64
CC: aarch64-linux-gnu-gcc
- platform: ubuntu-latest
alias: linux
- platform: macos-latest
alias: mac
- platform: windows-latest
GOOS: windows
GOARCH: amd64
- platform: macos-latest
GOOS: darwin
GOARCH: amd64
- platform: macos-latest
GOOS: darwin
GOARCH: arm64
runs-on: ${{ matrix.platform }}
alias: win
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go 1.x
@ -43,10 +33,6 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Install gcc
if: "${{ matrix.package != '' }}"
run: sudo apt-get update && sudo apt-get -y install ${{ matrix.package }}
- name: Set version
shell: bash
run: |
@ -54,31 +40,24 @@ jobs:
|| git symbolic-ref -q --short HEAD \
|| git rev-parse --short HEAD) > version.txt 2> /dev/null
- name: Prepare
run: |
mkdir -p dist/ && cd dist/
cp ../config.default.yml config.yml
- name: Get dependencies
run: go get
- name: Build
working-directory: ./dist
shell: bash
run: |
GOOS=${{ matrix.GOOS }} GOARCH=${{ matrix.GOARCH }} \
CC=${{ matrix.CC }} CGO_ENABLED=1 go build -v -ldflags '-w -s' ../
run: go build -v .
- name: Compress working folder (Windows PowerShell)
working-directory: ./dist
if: "${{ matrix.GOOS == 'windows' }}"
- name: Compress working folder on Windows
if: runner.os == 'Windows'
run: |
Compress-Archive -Path .\wakapi.exe, .\config.yml -DestinationPath wakapi_${{ matrix.GOOS }}_${{ matrix.GOARCH }}.zip
- name: Compress working folder
working-directory: ./dist
if: "${{ matrix.GOOS != 'windows' }}"
cp .\config.default.yml .\config.yml
Compress-Archive -Path .\wakapi.exe, .\config.yml -DestinationPath wakapi_${{ matrix.alias }}_amd64.zip
- name: Compress working folder on Unix
if: runner.os != 'Windows'
run: |
zip -9 wakapi_${{ matrix.GOOS }}_${{ matrix.GOARCH }}.zip *
cp config.default.yml config.yml
zip -9 wakapi_${{ matrix.alias }}_amd64.zip wakapi config.yml
- name: Upload built executable to Release
uses: softprops/action-gh-release@v1
with:
files: ./dist/*.zip
files: wakapi_${{ matrix.alias }}_amd64.zip

View File

@ -66,11 +66,6 @@ If you want to try out a free, hosted cloud service, all you need to do is creat
$ curl -L https://wakapi.dev/get | bash
```
**Alternatively** using [eget](https://github.com/zyedidia/eget):
```bash
$ eget muety/wakapi
```
### 🐳 Option 3: Use Docker
```bash

View File

@ -15,163 +15,54 @@
set -e -u
githubLatestTag() {
latestJSON="$( eval "$http 'https://api.github.com/repos/$1/releases/latest'" 2>/dev/null )" || true
versionNumber=''
if ! echo "$latestJSON" | grep 'API rate limit exceeded' >/dev/null 2>&1 ; then
if ! versionNumber="$( echo "$latestJSON" | grep -oEm1 '[0-9]+[.][0-9]+[.][0-9]+' - 2>/dev/null )" ; then
versionNumber=''
fi
fi
if [ "${versionNumber:-x}" = "x" ] ; then
# Try to fallback to previous latest version detection method if curl is available
if command -v curl >/dev/null 2>&1 ; then
if finalUrl="$( curl "https://github.com/$1/releases/latest" -s -L -I -o /dev/null -w '%{url_effective}' 2>/dev/null )" ; then
trimmedVers="${finalUrl##*v}"
if [ "${trimmedVers:-x}" != "x" ] ; then
echo "$trimmedVers"
exit 0
fi
fi
fi
cat 1>&2 << 'EOA'
/=====================================\\
| FAILED TO HTTP DOWNLOAD FILE |
\\=====================================/
Uh oh! We couldn't download needed internet resources for you. Perhaps you are
offline, your DNS servers are not set up properly, your internet plan doesn't
include GitHub, or the GitHub servers are down?
EOA
exit 1
else
echo "$versionNumber"
fi
finalUrl=$(curl "https://github.com/$1/releases/latest" -s -L -I -o /dev/null -w '%{url_effective}')
printf "%s\n" "${finalUrl##*/}"
}
if [ "${GETMICRO_HTTP:-x}" != "x" ]; then
http="$GETMICRO_HTTP"
elif command -v curl >/dev/null 2>&1 ; then
http="curl -L"
elif command -v wget >/dev/null 2>&1 ; then
http="wget -O-"
else
cat 1>&2 << 'EOA'
/=====================================\\
| COULD NOT FIND HTTP PROGRAM |
\\=====================================/
Uh oh! We couldn't find either curl or wget installed on your system.
To continue with installation, you have two options:
A. Install either wget or curl on your system. You may need to run `hash -r`.
B. Define GETMICRO_HTTP to be a command (with arguments deliminated by spaces)
that both follows HTTP redirects AND prints the fetched content to stdout.
For examples of option B, this script uses the below values for wget and curl:
$ curl https://wakapi.dev/get | GETMICRO_HTTP="curl -L" sh
$ wget -O- https://wakapi.dev/get | GETMICRO_HTTP="wget -O-" sh
EOA
exit 1
fi
platform=''
machine=$(uname -m)
machine=$(uname -m) # currently, Wakapi builds are only available for AMD64 anyway
if [ "${GETWAKAPI_PLATFORM:-x}" != "x" ]; then
platform="$GETWAKAPI_PLATFORM"
else
case "$(uname -s | tr '[:upper:]' '[:lower:]')" in
"linux")
case "$machine" in
"arm64"* | "aarch64"* ) platform='linux_arm64' ;;
*"64") platform='linux_amd64' ;;
esac
;;
"darwin")
case "$machine" in
"arm64"* | "aarch64"* ) platform='darwin_arm64' ;;
*"64") platform='darwin_amd64' ;;
esac;;
"msys"*|"cygwin"*|"mingw"*|*"_nt"*|"win"*)
case "$machine" in
"arm64"* | "aarch64"* ) platform='win_arm64' ;;
*"64") platform='win_amd64' ;;
esac
;;
"linux") platform='linux_amd64' ;;
"msys"*|"cygwin"*|"mingw"*|*"_nt"*|"win"*) platform='win_amd64' ;;
esac
fi
if [ "${platform:-x}" = "x" ]; then
cat 1>&2 << 'EOM'
if [ "x$platform" = "x" ]; then
cat << 'EOM'
/=====================================\\
| COULD NOT DETECT PLATFORM |
\\=====================================/
Uh oh! We couldn't automatically detect your operating system. You can file a
bug here: https://github.com/muety/wakapi
To continue with installation, please choose from one of the following values:
- win_amd64
- darwin_amd64
- linux_amd64
Export your selection as the GETWAKAPI_PLATFORM environment variable, and then
re-run this script.
For example:
$ curl https://getmic.ro | GETWAKAPI_PLATFORM=linux_amd64 sh
EOM
exit 1
else
echo "Detected platform: $platform"
printf "Detected platform: %s\n" "$platform"
fi
TAG=$(githubLatestTag muety/wakapi)
if command -v grep >/dev/null 2>&1 ; then
if ! echo "v$TAG" | grep -E '^v[0-9]+[.][0-9]+[.][0-9]+$' >/dev/null 2>&1 ; then
cat 1>&2 << 'EOM'
/=====================================\\
| INVALID TAG RECIEVED |
\\=====================================/
Uh oh! We recieved an invalid tag and cannot be sure that the tag will not break
this script.
Please open an issue on GitHub at https://github.com/muety/wakapi with
the invalid tag included:
EOM
echo "> $TAG" 1>&2
exit 1
fi
fi
printf "Tag: %s" "$TAG"
extension='zip'
echo "Latest Version: $TAG"
echo "Downloading https://github.com/muety/wakapi/releases/download/$TAG/wakapi_$platform.$extension"
printf "Latest Version: %s\n" "$TAG"
printf "Downloading https://github.com/muety/wakapi/releases/download/%s/wakapi_%s.%s\n" "$TAG" "$platform" "$extension"
eval "$http 'https://github.com/muety/wakapi/releases/download/$TAG/wakapi_$platform.$extension'" > "wakapi.$extension"
curl -L "https://github.com/muety/wakapi/releases/download/$TAG/wakapi_$platform.$extension" > "wakapi.$extension"
case "$extension" in
"zip") unzip -j "wakapi.$extension" -d "wakapi-$TAG" ;;
"tar.gz") tar -xvzf "wakapi.$extension" "wakapi-$TAG/wakapi" ;;
esac
mv wakapi-$TAG/* .
mv "wakapi-$TAG/wakapi" ./wakapi
mv "wakapi-$TAG/config.yml" ./config.yml
rm "wakapi.$extension"
rm -rf "wakapi-$TAG"