diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..56e3ac0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: CI for Quary CLI Action + +on: [push, pull_request] + +jobs: + test-action: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Test Install Latest Version + uses: ./ + with: + version: 'latest' + + - name: Test Install Specific Version + uses: ./ + with: + version: '0.0.67' diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..26fbe51 --- /dev/null +++ b/action.yml @@ -0,0 +1,26 @@ +name: 'Install Quary CLI' +description: 'Installs the Quary CLI on Ubuntu' +inputs: + version: + description: 'Version of Quary CLI to install' + required: false + default: 'latest' +runs: + using: 'composite' + steps: + - run: | + if [ "${{ inputs.version }}" = "latest" ]; then + # Fetch the latest release tag from GitHub API without authentication + LATEST_VERSION=$(curl -s https://api.github.com/repos/quarylabs/quary-cli/releases/latest | grep 'tag_name' | cut -d '"' -f 4) + echo "Latest version is $LATEST_VERSION" + VERSION=$LATEST_VERSION + else + VERSION=${{ inputs.version }} + fi + + echo "Installing Quary CLI version $VERSION" + wget https://github.com/quarylabs/quary-cli/releases/download/$VERSION/quary-$VERSION-quary-linux-x86_64-gnu.zip -O quary-cli.zip + unzip quary-cli.zip -d quary-cli + sudo mv "quary-cli/quary-$VERSION" /usr/local/bin/quary + quary --version + shell: bash