diff --git a/.gitattributes b/.gitattributes index d16251ec2..0de51b6d1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ pnpm-lock.yaml -diff package-lock.json -diff +.github/actions/publish-artifacts/dist/index.js -diff diff --git a/.github/actions/publish-artifacts/index.ts b/.github/actions/publish-artifacts/index.ts index 6e0b0406a..1896f8247 100644 --- a/.github/actions/publish-artifacts/index.ts +++ b/.github/actions/publish-artifacts/index.ts @@ -2,6 +2,7 @@ import client from '@actions/artifact'; import * as core from '@actions/core'; import * as glob from '@actions/glob'; import * as io from '@actions/io'; +import { exists } from '@actions/io/lib/io-util'; type OS = 'darwin' | 'windows' | 'linux'; type Arch = 'x64' | 'arm64'; @@ -43,13 +44,24 @@ const PROFILE = core.getInput('profile'); const BUNDLE_DIR = `target/${TARGET}/${PROFILE}/bundle`; const ARTIFACTS_DIR = '.artifacts'; const ARTIFACT_BASE = `Spacedrive-${OS}-${ARCH}`; +const FRONT_END_BUNDLE = 'apps/desktop/dist.tar.xz'; const UPDATER_ARTIFACT_NAME = `Spacedrive-Updater-${OS}-${ARCH}`; +const FRONTEND_ARCHIVE_NAME = `Spacedrive-frontend-${OS}-${ARCH}`; async function globFiles(pattern: string) { const globber = await glob.create(pattern); return await globber.glob(); } +async function uploadFrontend() { + if (!(await exists(FRONT_END_BUNDLE))) { + console.error(`Frontend archive not found`); + return; + } + + await client.uploadArtifact(FRONTEND_ARCHIVE_NAME, [FRONT_END_BUNDLE], 'apps/desktop'); +} + async function uploadUpdater(updater: BuildTarget['updater']) { if (!updater) return; const { bundle, bundleExt, archiveExt } = updater; @@ -57,7 +69,7 @@ async function uploadUpdater(updater: BuildTarget['updater']) { const files = await globFiles(`${BUNDLE_DIR}/${bundle}/*.${fullExt}*`); const updaterPath = files.find((file) => file.endsWith(fullExt)); - if (!updaterPath) return console.error(`Updater path not found. Files: ${files}`); + if (!updaterPath) throw new Error(`Updater path not found. Files: ${files}`); const artifactPath = `${ARTIFACTS_DIR}/${UPDATER_ARTIFACT_NAME}.${archiveExt}`; @@ -76,7 +88,7 @@ async function uploadStandalone({ bundle, ext }: TargetConfig) { const files = await globFiles(`${BUNDLE_DIR}/${bundle}/*.${ext}*`); const standalonePath = files.find((file) => file.endsWith(ext)); - if (!standalonePath) return console.error(`Standalone path not found. Files: ${files}`); + if (!standalonePath) throw new Error(`Standalone path not found. Files: ${files}`); const artifactName = `${ARTIFACT_BASE}.${ext}`; const artifactPath = `${ARTIFACTS_DIR}/${artifactName}`; @@ -90,10 +102,10 @@ async function run() { const { updater, standalone } = OS_TARGETS[OS]; - await uploadUpdater(updater); - - for (const config of standalone) { - await uploadStandalone(config); - } + await Promise.all([ + uploadUpdater(updater), + uploadFrontend(), + ...standalone.map((config) => uploadStandalone(config)) + ]); } run(); diff --git a/.github/actions/publish-artifacts/package.json b/.github/actions/publish-artifacts/package.json index cbfb85c8b..124890dd7 100644 --- a/.github/actions/publish-artifacts/package.json +++ b/.github/actions/publish-artifacts/package.json @@ -7,7 +7,7 @@ "lint": "eslint . --cache" }, "dependencies": { - "@actions/artifact": "^2.1.3", + "@actions/artifact": "^2.1.7", "@actions/core": "^1.10.1", "@actions/glob": "^0.4.0", "@actions/io": "^1.1.3" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6dedb68d9..0b91ca579 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,10 @@ name: Release on: + pull_request: + paths: + - '.github/workflows/release.yml' workflow_dispatch: -# NOTE: For Linux builds, we can only build with Ubuntu. It should be the oldest base system we intend to support. See PR-759 & https://tauri.app/v1/guides/building/linux for reference. # From: https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/release.yaml#L13-L21 env: @@ -112,6 +114,12 @@ jobs: APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + - name: Package frontend + if: ${{ runner.os == 'Linux' }} + run: | + set -eux + XZ_OPT='-T0 -7' tar -cJf apps/desktop/dist.tar.xz -C apps/desktop/dist . + - name: Publish Artifacts uses: ./.github/actions/publish-artifacts with: diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a3f6c67fe..f6f28c81e 100644 Binary files a/pnpm-lock.yaml and b/pnpm-lock.yaml differ diff --git a/scripts/fix-deb.sh b/scripts/fix-deb.sh index 19d30e29b..95e66a948 100755 --- a/scripts/fix-deb.sh +++ b/scripts/fix-deb.sh @@ -89,6 +89,17 @@ tar -xzf "${_tmp}/control.tar.gz" -C "${_tmp}/control" # Fix files owner chown -R root:root "$_tmp" +# Rename sd-desktop to spacedrive +find "${_tmp}" -name 'sd-desktop' -o \( -type f -name 'sd-desktop.*' \) | while IFS= read -r file +do + filename="$(basename "$file")" + if [ "$filename" = "sd-desktop" ]; then + mv "$file" "$(dirname "$file")/spacedrive" + else + mv "$file" "$(dirname "$file")/spacedrive.${filename#*.}" + fi +done + # Create doc directory mkdir -p "$_tmp"/data/usr/share/{doc/spacedrive,man/man1}