fix(ci): pre built tar.gz (#488)
This commit is contained in:
parent
0c14792f21
commit
90c5f724e6
6
.github/workflows/release.yaml
vendored
6
.github/workflows/release.yaml
vendored
@ -84,16 +84,16 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd results
|
cd results
|
||||||
tar cvf avante_lib-${{ matrix.os }}-${{ matrix.feature }}.tar *.${EXT}
|
tar zcvf avante_lib-${{ matrix.os }}-${{ matrix.feature }}.tar.gz *.${EXT}
|
||||||
|
|
||||||
- name: Upload Release Asset
|
- name: Upload Release Asset
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
uses: shogo82148/actions-upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
ASSET_NAME: avante_lib-${{ matrix.os }}-${{ matrix.feature }}.tar
|
ASSET_NAME: avante_lib-${{ matrix.os }}-${{ matrix.feature }}.tar.gz
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
|
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
|
||||||
asset_path: ./results/avante_lib-${{ matrix.os }}-${{ matrix.feature }}.tar
|
asset_path: ./results/avante_lib-${{ matrix.os }}-${{ matrix.feature }}.tar.gz
|
||||||
|
|
||||||
publish-release:
|
publish-release:
|
||||||
permissions:
|
permissions:
|
||||||
|
28
build.sh
28
build.sh
@ -1,18 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eo pipefail
|
set -xeo pipefail
|
||||||
|
|
||||||
# Check if jq is installed
|
|
||||||
if ! command -v jq &>/dev/null; then
|
|
||||||
echo "Error: jq is not installed. Please install jq."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if GITHUB_TOKEN is set
|
|
||||||
if [ -z "$GITHUB_TOKEN" ]; then
|
|
||||||
echo "Error: GITHUB_TOKEN is not set. Please provide a valid GitHub token."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
REPO_OWNER="yetone"
|
REPO_OWNER="yetone"
|
||||||
REPO_NAME="avante.nvim"
|
REPO_NAME="avante.nvim"
|
||||||
@ -22,12 +10,6 @@ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
|||||||
# Set the target directory to clone the artifact
|
# Set the target directory to clone the artifact
|
||||||
TARGET_DIR="${SCRIPT_DIR}/build"
|
TARGET_DIR="${SCRIPT_DIR}/build"
|
||||||
|
|
||||||
# Get the latest successful run ID of the workflow
|
|
||||||
RUN_ID=$(curl -s \
|
|
||||||
-H "Accept: application/vnd.github+json" \
|
|
||||||
-H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
||||||
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/workflows/build.yaml/runs?status=success&branch=main&per_page=1" | jq ".workflow_runs[0].id")
|
|
||||||
|
|
||||||
# Get the artifact download URL based on the platform and Lua version
|
# Get the artifact download URL based on the platform and Lua version
|
||||||
case "$(uname -s)" in
|
case "$(uname -s)" in
|
||||||
Linux*)
|
Linux*)
|
||||||
@ -52,12 +34,8 @@ LUA_VERSION="${LUA_VERSION:-luajit}"
|
|||||||
ARTIFACT_NAME_PATTERN="avante_lib-$PLATFORM-latest-$LUA_VERSION"
|
ARTIFACT_NAME_PATTERN="avante_lib-$PLATFORM-latest-$LUA_VERSION"
|
||||||
|
|
||||||
# Get the artifact download URL
|
# Get the artifact download URL
|
||||||
ARTIFACT_URL=$(curl -s \
|
ARTIFACT_URL=$(curl -s "https://api.github.com/repos/yetone/avante.nvim/releases/latest" | grep "browser_download_url" | cut -d '"' -f 4 | grep $ARTIFACT_NAME_PATTERN)
|
||||||
-H "Accept: application/vnd.github+json" \
|
|
||||||
-H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
||||||
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/runs/$RUN_ID/artifacts" |
|
|
||||||
jq -r '.artifacts[] | select(.name | test("'"$ARTIFACT_NAME_PATTERN"'")) | .archive_download_url')
|
|
||||||
|
|
||||||
mkdir -p "$TARGET_DIR"
|
mkdir -p "$TARGET_DIR"
|
||||||
|
|
||||||
curl -L -H "Authorization: Bearer $GITHUB_TOKEN" "$ARTIFACT_URL" | tar -x -C "$TARGET_DIR"
|
curl -L "$ARTIFACT_URL" | tar -zxv -C "$TARGET_DIR"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user