Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
Merge pull request #1 from airtonix/feat/linux-desktop-releases
feat(desktop): publish Linux AppImage releases
This commit is contained in:
@@ -19,16 +19,26 @@ concurrency:
|
|||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-release:
|
build:
|
||||||
name: Build and publish Windows desktop
|
name: Build ${{ matrix.platform }} desktop
|
||||||
runs-on: windows-latest
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- platform: windows
|
||||||
|
runner: windows-latest
|
||||||
|
artifact: desktop-windows
|
||||||
|
- platform: linux
|
||||||
|
runner: ubuntu-latest
|
||||||
|
artifact: desktop-linux
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out source
|
- name: Check out source
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.sha }}
|
||||||
|
|
||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@@ -38,44 +48,30 @@ jobs:
|
|||||||
|
|
||||||
- name: Resolve release version
|
- name: Resolve release version
|
||||||
id: version
|
id: version
|
||||||
shell: pwsh
|
shell: bash
|
||||||
run: |
|
|
||||||
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
|
|
||||||
$version = "${{ inputs.version }}".Trim().TrimStart("v")
|
|
||||||
$tag = "v$version"
|
|
||||||
} else {
|
|
||||||
$tag = "${{ github.ref_name }}"
|
|
||||||
$version = $tag.TrimStart("v")
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($version -notmatch '^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$') {
|
|
||||||
throw "Invalid release version: $version"
|
|
||||||
}
|
|
||||||
|
|
||||||
"version=$version" >> $env:GITHUB_OUTPUT
|
|
||||||
"tag=$tag" >> $env:GITHUB_OUTPUT
|
|
||||||
Write-Host "Building SketchForge $version ($tag)"
|
|
||||||
|
|
||||||
- name: Ensure release tag exists
|
|
||||||
if: github.event_name == 'workflow_dispatch'
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
INPUT_VERSION: ${{ inputs.version }}
|
||||||
TAG: ${{ steps.version.outputs.tag }}
|
TAG_NAME: ${{ github.ref_name }}
|
||||||
|
EVENT_NAME: ${{ github.event_name }}
|
||||||
run: |
|
run: |
|
||||||
git fetch --tags --force
|
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
|
||||||
if (git rev-parse $env:TAG 2>$null) {
|
version="${INPUT_VERSION#v}"
|
||||||
Write-Host "$env:TAG already exists."
|
else
|
||||||
} else {
|
version="${TAG_NAME#v}"
|
||||||
git tag $env:TAG $env:GITHUB_SHA
|
fi
|
||||||
git push origin $env:TAG
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: Set package version from release tag
|
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
|
||||||
shell: pwsh
|
echo "Invalid release version: $version" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Set package version
|
||||||
|
shell: bash
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ steps.version.outputs.version }}
|
VERSION: ${{ steps.version.outputs.version }}
|
||||||
run: npm version $env:VERSION --no-git-tag-version --allow-same-version
|
run: npm version "$VERSION" --no-git-tag-version --allow-same-version
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@@ -86,113 +82,166 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: npm test
|
run: npm test
|
||||||
|
|
||||||
- name: Build Windows desktop update
|
- name: Build desktop package
|
||||||
run: npm run desktop:dist
|
run: npm run desktop:dist
|
||||||
|
|
||||||
- name: Verify updater artifacts
|
- name: Verify Windows artifacts
|
||||||
|
if: matrix.platform == 'windows'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
env:
|
env:
|
||||||
VERSION: ${{ steps.version.outputs.version }}
|
VERSION: ${{ steps.version.outputs.version }}
|
||||||
run: |
|
run: |
|
||||||
$installer = "dist/desktop/SketchForge-Setup-$env:VERSION-x64.exe"
|
$required = @(
|
||||||
$blockmap = "$installer.blockmap"
|
"dist/desktop/SketchForge-Setup-$env:VERSION-x64.exe",
|
||||||
$latest = "dist/desktop/latest.yml"
|
"dist/desktop/SketchForge-Setup-$env:VERSION-x64.exe.blockmap",
|
||||||
|
"dist/desktop/latest.yml"
|
||||||
foreach ($file in @($installer, $blockmap, $latest)) {
|
)
|
||||||
|
foreach ($file in $required) {
|
||||||
if (-not (Test-Path $file -PathType Leaf)) {
|
if (-not (Test-Path $file -PathType Leaf)) {
|
||||||
throw "Missing updater artifact: $file"
|
throw "Missing Windows artifact: $file"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$metadata = Get-Content $latest -Raw
|
- name: Verify Linux artifacts
|
||||||
if ($metadata -notmatch "version:\s*$([regex]::Escape($env:VERSION))") {
|
if: matrix.platform == 'linux'
|
||||||
throw "latest.yml does not contain version $env:VERSION"
|
shell: bash
|
||||||
}
|
env:
|
||||||
|
VERSION: ${{ steps.version.outputs.version }}
|
||||||
|
run: |
|
||||||
|
test -f "dist/desktop/SketchForge-$VERSION-x86_64.AppImage"
|
||||||
|
test -f dist/desktop/latest-linux.yml
|
||||||
|
|
||||||
$hash = (Get-FileHash $installer -Algorithm SHA256).Hash.ToLowerInvariant()
|
- name: Store Windows artifacts
|
||||||
Write-Host "Installer SHA-256: $hash"
|
if: matrix.platform == 'windows'
|
||||||
Write-Host "Installer size: $((Get-Item $installer).Length) bytes"
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.artifact }}
|
||||||
|
path: |
|
||||||
|
dist/desktop/SketchForge-Setup-*-x64.exe
|
||||||
|
dist/desktop/SketchForge-Setup-*-x64.exe.blockmap
|
||||||
|
dist/desktop/latest.yml
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Store Linux artifacts
|
||||||
|
if: matrix.platform == 'linux'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.artifact }}
|
||||||
|
path: |
|
||||||
|
dist/desktop/SketchForge-*.AppImage
|
||||||
|
dist/desktop/latest-linux.yml
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
attach:
|
||||||
|
name: Attach packages to release
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out source
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Resolve release metadata
|
||||||
|
id: version
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
INPUT_VERSION: ${{ inputs.version }}
|
||||||
|
TAG_NAME: ${{ github.ref_name }}
|
||||||
|
EVENT_NAME: ${{ github.event_name }}
|
||||||
|
run: |
|
||||||
|
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
|
||||||
|
version="${INPUT_VERSION#v}"
|
||||||
|
tag="v$version"
|
||||||
|
else
|
||||||
|
tag="$TAG_NAME"
|
||||||
|
version="${tag#v}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
|
||||||
|
echo "Invalid release version: $version" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Ensure release tag exists
|
||||||
|
if: github.event_name == 'workflow_dispatch'
|
||||||
|
env:
|
||||||
|
TAG: ${{ steps.version.outputs.tag }}
|
||||||
|
SOURCE_SHA: ${{ github.sha }}
|
||||||
|
run: |
|
||||||
|
git fetch --tags --force
|
||||||
|
if git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||||
|
echo "$TAG already exists."
|
||||||
|
else
|
||||||
|
git tag "$TAG" "$SOURCE_SHA"
|
||||||
|
git push origin "$TAG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Download Windows artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: desktop-windows
|
||||||
|
path: dist/release
|
||||||
|
|
||||||
|
- name: Download Linux artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: desktop-linux
|
||||||
|
path: dist/release
|
||||||
|
|
||||||
- name: Create draft release
|
- name: Create draft release
|
||||||
shell: pwsh
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ steps.version.outputs.tag }}
|
TAG: ${{ steps.version.outputs.tag }}
|
||||||
VERSION: ${{ steps.version.outputs.version }}
|
VERSION: ${{ steps.version.outputs.version }}
|
||||||
run: |
|
run: |
|
||||||
$existing = gh release view $env:TAG --json isDraft 2>$null
|
existing=$(gh release view "$TAG" --json isDraft 2>/dev/null || true)
|
||||||
if ($LASTEXITCODE -eq 0) {
|
if [ -n "$existing" ]; then
|
||||||
$release = $existing | ConvertFrom-Json
|
is_draft=$(jq -r '.isDraft' <<< "$existing")
|
||||||
if (-not $release.isDraft) {
|
if [ "$is_draft" != "true" ]; then
|
||||||
throw "Release $env:TAG is already published. Refusing to replace a live updater release."
|
echo "Release $TAG is already published. Refusing to replace it." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Using existing draft release $TAG."
|
||||||
|
else
|
||||||
|
gh release create "$TAG" --draft --verify-tag \
|
||||||
|
--title "SketchForge $VERSION" \
|
||||||
|
--notes "SketchForge desktop $VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Upload desktop packages
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
TAG: ${{ steps.version.outputs.tag }}
|
||||||
|
run: gh release upload "$TAG" dist/release/* --clobber
|
||||||
|
|
||||||
|
- name: Verify release assets
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
TAG: ${{ steps.version.outputs.tag }}
|
||||||
|
VERSION: ${{ steps.version.outputs.version }}
|
||||||
|
run: |
|
||||||
|
assets=$(gh release view "$TAG" --json isDraft,assets)
|
||||||
|
test "$(jq -r '.isDraft' <<< "$assets")" = "true"
|
||||||
|
names=$(jq -r '.assets[].name' <<< "$assets")
|
||||||
|
for expected in \
|
||||||
|
"SketchForge-Setup-$VERSION-x64.exe" \
|
||||||
|
"SketchForge-Setup-$VERSION-x64.exe.blockmap" \
|
||||||
|
"latest.yml" \
|
||||||
|
"SketchForge-$VERSION-x86_64.AppImage" \
|
||||||
|
"latest-linux.yml"; do
|
||||||
|
grep -Fxq "$expected" <<< "$names" || {
|
||||||
|
echo "GitHub release is missing $expected" >&2
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
Write-Host "Using existing draft release $env:TAG."
|
done
|
||||||
} else {
|
|
||||||
gh release create $env:TAG --draft --verify-tag --title "SketchForge $env:VERSION" --notes "SketchForge desktop $env:VERSION"
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: Upload updater assets to draft
|
- name: Publish release as latest
|
||||||
shell: pwsh
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ steps.version.outputs.tag }}
|
TAG: ${{ steps.version.outputs.tag }}
|
||||||
VERSION: ${{ steps.version.outputs.version }}
|
run: gh release edit "$TAG" --draft=false --latest
|
||||||
run: |
|
|
||||||
$installer = "dist/desktop/SketchForge-Setup-$env:VERSION-x64.exe"
|
|
||||||
gh release upload $env:TAG `
|
|
||||||
$installer `
|
|
||||||
"$installer.blockmap" `
|
|
||||||
"dist/desktop/latest.yml" `
|
|
||||||
--clobber
|
|
||||||
|
|
||||||
- name: Verify GitHub release assets
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
TAG: ${{ steps.version.outputs.tag }}
|
|
||||||
VERSION: ${{ steps.version.outputs.version }}
|
|
||||||
run: |
|
|
||||||
$release = gh release view $env:TAG --json isDraft,assets | ConvertFrom-Json
|
|
||||||
if (-not $release.isDraft) {
|
|
||||||
throw "Release became public before verification."
|
|
||||||
}
|
|
||||||
|
|
||||||
$expected = @(
|
|
||||||
"SketchForge-Setup-$env:VERSION-x64.exe",
|
|
||||||
"SketchForge-Setup-$env:VERSION-x64.exe.blockmap",
|
|
||||||
"latest.yml"
|
|
||||||
)
|
|
||||||
$actual = @($release.assets | ForEach-Object { $_.name })
|
|
||||||
|
|
||||||
foreach ($name in $expected) {
|
|
||||||
if ($actual -notcontains $name) {
|
|
||||||
throw "GitHub release is missing $name"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($release.assets.Count -lt 3) {
|
|
||||||
throw "Expected at least 3 release assets."
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: Publish release as Latest
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
TAG: ${{ steps.version.outputs.tag }}
|
|
||||||
run: gh release edit $env:TAG --draft=false --latest
|
|
||||||
|
|
||||||
- name: Final release check
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
TAG: ${{ steps.version.outputs.tag }}
|
|
||||||
run: |
|
|
||||||
$release = gh release view $env:TAG --json tagName,isDraft,publishedAt,assets | ConvertFrom-Json
|
|
||||||
if ($release.isDraft) {
|
|
||||||
throw "Release $env:TAG is still a draft."
|
|
||||||
}
|
|
||||||
$latestTag = gh api "repos/$env:GITHUB_REPOSITORY/releases/latest" --jq '.tag_name'
|
|
||||||
if ($latestTag -ne $env:TAG) {
|
|
||||||
throw "Latest release is $latestTag instead of $env:TAG"
|
|
||||||
}
|
|
||||||
Write-Host "$env:TAG is published as Latest with $($release.assets.Count) assets."
|
|
||||||
@@ -46,6 +46,7 @@ mac:
|
|||||||
artifactName: ${productName}-${version}-${arch}.${ext}
|
artifactName: ${productName}-${version}-${arch}.${ext}
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
|
syncDesktopName: true
|
||||||
icon: apps/web/public/assets/sketchforge/sketchforge-logo.png
|
icon: apps/web/public/assets/sketchforge/sketchforge-logo.png
|
||||||
target:
|
target:
|
||||||
- AppImage
|
- AppImage
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
"name": "sketchforge",
|
"name": "sketchforge",
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"description": "A local-first 3D design editor.",
|
||||||
|
"author": {
|
||||||
|
"name": "SketchForge contributors"
|
||||||
|
},
|
||||||
|
"homepage": "https://sketchforge3d.com",
|
||||||
|
"desktopName": "sketchforge",
|
||||||
"main": "apps/desktop/main.cjs",
|
"main": "apps/desktop/main.cjs",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user