mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 09:04:27 +00:00
Refactor release workflow to use GitHub CLI for asset uploads and improve checksum generation process
This commit is contained in:
73
.github/workflows/release.yaml
vendored
73
.github/workflows/release.yaml
vendored
@@ -69,7 +69,6 @@ jobs:
|
|||||||
path: webui/dist/
|
path: webui/dist/
|
||||||
|
|
||||||
- name: Build binary
|
- name: Build binary
|
||||||
id: build_binary
|
|
||||||
env:
|
env:
|
||||||
GOOS: ${{ matrix.goos }}
|
GOOS: ${{ matrix.goos }}
|
||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: ${{ matrix.goarch }}
|
||||||
@@ -190,17 +189,20 @@ jobs:
|
|||||||
prerelease: ${{ contains(github.ref_name, '-') }}
|
prerelease: ${{ contains(github.ref_name, '-') }}
|
||||||
|
|
||||||
- name: Upload Release Assets
|
- name: Upload Release Assets
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
# Install GitHub CLI
|
||||||
|
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
|
||||||
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install gh -y
|
||||||
|
|
||||||
|
# Upload each asset
|
||||||
for asset in release-assets/*; do
|
for asset in release-assets/*; do
|
||||||
if [ -f "$asset" ]; then
|
if [ -f "$asset" ]; then
|
||||||
echo "Uploading $asset"
|
echo "Uploading $(basename "$asset")"
|
||||||
asset_name=$(basename "$asset")
|
gh release upload ${{ github.ref_name }} "$asset" --repo ${{ github.repository }}
|
||||||
curl \
|
|
||||||
-X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/octet-stream" \
|
|
||||||
--data-binary @"$asset" \
|
|
||||||
"${{ steps.create_release.outputs.upload_url }}?name=${asset_name}"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -209,37 +211,44 @@ jobs:
|
|||||||
needs: [release]
|
needs: [release]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Download release assets
|
- name: Download all build artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: artifacts/
|
||||||
|
|
||||||
|
- name: Prepare assets and generate checksums
|
||||||
run: |
|
run: |
|
||||||
mkdir -p assets
|
mkdir -p assets
|
||||||
# Get release assets
|
|
||||||
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
||||||
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}" | \
|
|
||||||
jq -r '.id')
|
|
||||||
|
|
||||||
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
# Copy all archives to assets directory
|
||||||
"https://api.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets" | \
|
find artifacts/ -name "*.tar.gz" -o -name "*.zip" | while read file; do
|
||||||
jq -r '.[].browser_download_url' | \
|
cp "$file" assets/
|
||||||
while read url; do
|
|
||||||
echo "Downloading $url"
|
|
||||||
curl -L -o "assets/$(basename "$url")" "$url"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Generate checksums
|
# List what we have
|
||||||
run: |
|
echo "Files found:"
|
||||||
|
ls -la assets/
|
||||||
|
|
||||||
|
# Generate checksums if we have files
|
||||||
cd assets
|
cd assets
|
||||||
|
if [ "$(ls -A .)" ]; then
|
||||||
sha256sum * > checksums.txt
|
sha256sum * > checksums.txt
|
||||||
|
echo "Generated checksums:"
|
||||||
cat checksums.txt
|
cat checksums.txt
|
||||||
|
else
|
||||||
|
echo "No files found to checksum"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Upload checksums
|
- name: Upload checksums to release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
# Install GitHub CLI
|
||||||
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}" | \
|
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
|
||||||
jq -r '.id')
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install gh -y
|
||||||
|
|
||||||
curl \
|
# Upload checksums
|
||||||
-X POST \
|
gh release upload ${{ github.ref_name }} assets/checksums.txt --repo ${{ github.repository }}
|
||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
||||||
-H "Content-Type: text/plain" \
|
|
||||||
--data-binary @assets/checksums.txt \
|
|
||||||
"https://uploads.github.com/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets?name=checksums.txt"
|
|
||||||
Reference in New Issue
Block a user