All checks were successful
Release / Bump version and tag (push) Successful in 7s
The workflow_dispatch input was accessed as github.event.inputs.tag which can be empty depending on the Gitea runner. Now tries both inputs.tag (modern syntax) and github.event.inputs.tag as fallback, with a final fallback to the latest matching git tag. Also switched Windows Determine-tag steps from PowerShell to bash (via Git Bash) for consistency with the other platforms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
104 lines
3.6 KiB
YAML
104 lines
3.6 KiB
YAML
name: Build App (Linux)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Release tag to build (e.g. v1.4.5)'
|
|
required: true
|
|
|
|
jobs:
|
|
build-linux:
|
|
name: Build App (Linux)
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NODE_VERSION: "20"
|
|
steps:
|
|
- name: Determine tag
|
|
id: tag
|
|
run: |
|
|
TAG="${{ inputs.tag }}"
|
|
if [ -z "$TAG" ]; then
|
|
TAG="${{ github.event.inputs.tag }}"
|
|
fi
|
|
if [ -z "$TAG" ]; then
|
|
TAG=$(git ls-remote --tags --sort=-v:refname origin 'refs/tags/v*' | head -1 | sed 's|.*refs/tags/||')
|
|
fi
|
|
echo "Building for tag: ${TAG}"
|
|
echo "tag=${TAG}" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ steps.tag.outputs.tag }}
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Install Rust stable
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils rpm
|
|
|
|
- name: Install npm dependencies
|
|
run: npm ci
|
|
|
|
- name: Build Tauri app
|
|
run: npm run tauri build
|
|
|
|
- name: Upload to release
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
sudo apt-get install -y jq
|
|
REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
|
|
TAG="${{ steps.tag.outputs.tag }}"
|
|
echo "Release tag: ${TAG}"
|
|
|
|
echo "Waiting for release ${TAG} to be available..."
|
|
RELEASE_ID=""
|
|
for i in $(seq 1 30); do
|
|
RELEASE_JSON=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/tags/${TAG}")
|
|
RELEASE_ID=$(echo "$RELEASE_JSON" | jq -r '.id // empty')
|
|
|
|
if [ -n "${RELEASE_ID}" ] && [ "${RELEASE_ID}" != "null" ]; then
|
|
echo "Found release: ${TAG} (ID: ${RELEASE_ID})"
|
|
break
|
|
fi
|
|
|
|
echo "Attempt ${i}/30: Release not ready yet, retrying in 10s..."
|
|
sleep 10
|
|
done
|
|
|
|
if [ -z "${RELEASE_ID}" ] || [ "${RELEASE_ID}" = "null" ]; then
|
|
echo "ERROR: Failed to find release for tag ${TAG} after 30 attempts."
|
|
exit 1
|
|
fi
|
|
|
|
find src-tauri/target/release/bundle -type f \( -name "*.deb" -o -name "*.rpm" -o -name "*.AppImage" \) | while IFS= read -r file; do
|
|
filename=$(basename "$file")
|
|
encoded_name=$(echo "$filename" | sed 's/ /%20/g')
|
|
echo "Uploading ${filename} ($(du -h "$file" | cut -f1))..."
|
|
|
|
ASSET_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets" | jq -r ".[] | select(.name == \"${filename}\") | .id // empty")
|
|
if [ -n "${ASSET_ID}" ]; then
|
|
curl -s -X DELETE -H "Authorization: token ${BUILD_TOKEN}" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
|
fi
|
|
|
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
|
|
-H "Authorization: token ${BUILD_TOKEN}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
-T "$file" \
|
|
"${REPO_API}/releases/${RELEASE_ID}/assets?name=${encoded_name}")
|
|
echo "Upload response: HTTP ${HTTP_CODE}"
|
|
done
|