ci: add Gitea Actions workflows for Linux-only CI and release
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>
This commit is contained in:
91
.gitea/workflows/build.yml
Normal file
91
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, master]
|
||||||
|
pull_request:
|
||||||
|
branches: [main, master]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ gitea.workflow }}-${{ gitea.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint-and-test:
|
||||||
|
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
|
||||||
|
with:
|
||||||
|
components: clippy, rustfmt
|
||||||
|
|
||||||
|
- 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: ESLint
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Rust fmt check
|
||||||
|
run: cd src-tauri && cargo fmt --check
|
||||||
|
|
||||||
|
- name: Rust clippy
|
||||||
|
run: cd src-tauri && cargo clippy -- -D warnings
|
||||||
|
|
||||||
|
- name: Rust tests
|
||||||
|
run: cd src-tauri && cargo test
|
||||||
|
|
||||||
|
- name: Frontend tests
|
||||||
|
run: npm test
|
||||||
|
|
||||||
|
build:
|
||||||
|
needs: lint-and-test
|
||||||
|
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: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: tusk-linux-x64
|
||||||
|
path: |
|
||||||
|
src-tauri/target/release/bundle/deb/*.deb
|
||||||
|
src-tauri/target/release/bundle/rpm/*.rpm
|
||||||
|
src-tauri/target/release/bundle/appimage/*.AppImage
|
||||||
|
if-no-files-found: ignore
|
||||||
89
.gitea/workflows/release.yml
Normal file
89
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
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"
|
||||||
Reference in New Issue
Block a user