diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c31f34..2f6f5ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,10 +57,3 @@ jobs: - name: set release version run: | echo '${{ github.ref_name }}' > tag - - name: Push files - run: | - git config user.name github-actions - git config user.email github-actions@github.com - git add tag - git commit -m "[Automatic] bumpup version to ${{ github.ref_name }}" - git push diff --git a/gh-echojava b/gh-echojava new file mode 100644 index 0000000..aa72f7a --- /dev/null +++ b/gh-echojava @@ -0,0 +1,66 @@ +#!/bin/bash +set -e + +extensionPath="$(dirname "$0")" + +tag=v0.1.7 +imagename="gh-echo" +repo="DarkWeird/gh-echojava" +arch="$(uname -m)" + +exe="" + +# resolve exe name for fetch release from GitHub releases. +if uname -a | grep Msys > /dev/null; then + if [ $arch = "x86_64" ]; then + exe="${imagename}-Windows.exe" + fi +elif uname -a | grep Darwin > /dev/null; then + if [ $arch = "x86_64" ]; then + exe="${imagename}-macOS" + fi +elif uname -a | grep Linux > /dev/null; then + if [ $arch = "x86_64" ]; then + exe="${imagename}-Linux" + fi +fi + +executablePath = ""; + +if [ "${exe}" == "" ]; then + if uname -a | grep Msys >/dev/null; then + imagename = "${imagename}.exe" + fi + if [[ -x "${extensionPath}/build/libs/gh-echo-0.1-all.jar"]]; then + # JVM variant + executablePath = "${extensionPath}/build/libs/gh-echo-0.1-all.jar" + elif [[ -x "${extensionPath}/build/native/nativeCompile/${imagename}"]]; then + # Native Image variant + executablePath = "${extensionPath}/build/native/nativeCompile/${imagename}" + else + if [ ! "$(which javac)" = "" ]; then + if [ ! "$(which native-image)" = ""]; then + ./gradlew nativeCompile + executablePath = "${extensionPath}/build/native/nativeCompile/${imagename}" + else + ./gradlew shadowJar + executablePath = "${extensionPath}/build/libs/gh-echo-0.1-all.jar" + fi + else + echo "You haven't java for building this project" + exit 1; + fi + fi + +else + executablePath = "${extensionPath}/${exe}" + # Check release executable + if [[ ! -x "${executablePath}" ]]; then + #Fetch release + gh release -R"${repo}" download "${tag}" -p "${exe}" --dir "${extensionPath}" + e + chmod +x "${executablePath}" + fi +fi + +exec "${extensionPath}/${exe}" "$@" \ No newline at end of file