mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2025-12-11 20:15:30 +01:00
Package & distribute frontend bundle when doing releases for Linux (#2500)
* Package & distribute frontend bundle when doing releases for Linux * Only check for tar.xz frontend bundle * debug * Fix sd-desktop
This commit is contained in:
parent
6b465008a1
commit
ae06459eea
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,2 +1,3 @@
|
||||
pnpm-lock.yaml -diff
|
||||
package-lock.json -diff
|
||||
.github/actions/publish-artifacts/dist/index.js -diff
|
||||
|
||||
26
.github/actions/publish-artifacts/index.ts
vendored
26
.github/actions/publish-artifacts/index.ts
vendored
@ -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();
|
||||
|
||||
@ -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"
|
||||
|
||||
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@ -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:
|
||||
|
||||
631
pnpm-lock.yaml
generated
631
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -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}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user