Adapt GitHub Actions workflows for Gitea with Docker runner: - Linux-only builds (no macOS/Windows matrix) - Manual `npm run tauri build` instead of tauri-action - Release creation via Gitea API with asset upload Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
90 lines
2.6 KiB
YAML
90 lines
2.6 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Linux dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: src-tauri
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
|
|
- name: Install frontend dependencies
|
|
run: npm ci
|
|
|
|
- name: Build Tauri app
|
|
run: npm run tauri build
|
|
|
|
- name: Create release and upload assets
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
run: |
|
|
TAG_NAME="${GITHUB_REF_NAME}"
|
|
REPO="${GITHUB_REPOSITORY}"
|
|
SERVER_URL="${GITHUB_SERVER_URL}"
|
|
API_URL="${SERVER_URL}/api/v1"
|
|
|
|
# Create release
|
|
RELEASE_RESPONSE=$(curl -s -X POST \
|
|
"${API_URL}/repos/${REPO}/releases" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"tag_name\": \"${TAG_NAME}\",
|
|
\"name\": \"Tusk ${TAG_NAME}\",
|
|
\"body\": \"See the assets below to download Tusk for your platform.\",
|
|
\"draft\": true,
|
|
\"prerelease\": false
|
|
}")
|
|
|
|
RELEASE_ID=$(echo "${RELEASE_RESPONSE}" | jq -r '.id')
|
|
|
|
if [ "${RELEASE_ID}" = "null" ] || [ -z "${RELEASE_ID}" ]; then
|
|
echo "Failed to create release:"
|
|
echo "${RELEASE_RESPONSE}"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Created release with ID: ${RELEASE_ID}"
|
|
|
|
# Upload assets
|
|
upload_asset() {
|
|
local file="$1"
|
|
local filename=$(basename "${file}")
|
|
echo "Uploading ${filename}..."
|
|
curl -s -X POST \
|
|
"${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${filename}" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary "@${file}"
|
|
}
|
|
|
|
for pattern in \
|
|
"src-tauri/target/release/bundle/deb/*.deb" \
|
|
"src-tauri/target/release/bundle/rpm/*.rpm" \
|
|
"src-tauri/target/release/bundle/appimage/*.AppImage"; do
|
|
for file in ${pattern}; do
|
|
[ -f "${file}" ] && upload_asset "${file}"
|
|
done
|
|
done
|
|
|
|
echo "Release created successfully"
|