-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* js-based publish workflow * don't create release if not using tag * rename * update lockfile * remove unnecessary tsconfigs * replace old publish action * dumb * esmodule moment * glob files * lockfile * build app bundle * Fix artifact upload hopefully * upload artifacts from root * skill issue ffs * Use copy instead of move * hopefully last one * artifcats * make .artifacts -_- * ffs * Make cp recursive, so it work with dirs * build * separate updater & standalone targets * create draft release --------- Co-authored-by: Vítor Vasconcellos <[email protected]>
- Loading branch information
1 parent
39744b5
commit b27c5ac
Showing
9 changed files
with
364 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import * as artifact from '@actions/artifact'; | ||
import * as core from '@actions/core'; | ||
import * as glob from '@actions/glob'; | ||
import * as io from '@actions/io'; | ||
|
||
type OS = 'darwin' | 'windows' | 'linux'; | ||
type Arch = 'x64' | 'arm64'; | ||
type TargetConfig = { bundle: string; ext: string }; | ||
type BuildTarget = { | ||
updater: TargetConfig; | ||
standalone: Array<TargetConfig>; | ||
}; | ||
|
||
const OS_TARGETS = { | ||
darwin: { | ||
updater: { | ||
bundle: 'macos', | ||
ext: 'app.tar.gz' | ||
}, | ||
standalone: [{ ext: 'dmg', bundle: 'dmg' }] | ||
}, | ||
windows: { | ||
updater: { | ||
bundle: 'msi', | ||
ext: 'msi.zip' | ||
}, | ||
standalone: [{ ext: 'msi', bundle: 'msi' }] | ||
}, | ||
linux: { | ||
updater: { | ||
bundle: 'appimage', | ||
ext: 'AppImage.tar.gz' | ||
}, | ||
standalone: [ | ||
{ ext: 'deb', bundle: 'deb' }, | ||
{ ext: 'AppImage', bundle: 'appimage' } | ||
] | ||
} | ||
} satisfies Record<OS, BuildTarget>; | ||
|
||
// Workflow inputs | ||
const OS: OS = core.getInput('os') as any; | ||
const ARCH: Arch = core.getInput('arch') as any; | ||
const TARGET = core.getInput('target'); | ||
const PROFILE = core.getInput('profile'); | ||
|
||
const BUNDLE_DIR = `target/${TARGET}/${PROFILE}/bundle`; | ||
const ARTIFACTS_DIR = '.artifacts'; | ||
const ARTIFACT_BASE = `Spacedrive-${OS}-${ARCH}`; | ||
const UPDATER_ARTIFACT_NAME = `Spacedrive-Updater-${OS}-${ARCH}`; | ||
|
||
const client = artifact.create(); | ||
|
||
async function globFiles(pattern: string) { | ||
const globber = await glob.create(pattern); | ||
return await globber.glob(); | ||
} | ||
|
||
async function uploadUpdater({ bundle, ext }: TargetConfig) { | ||
const files = await globFiles(`${BUNDLE_DIR}/${bundle}/*.${ext}*`); | ||
|
||
const updaterPath = files.find((file) => file.endsWith(ext)); | ||
if (!updaterPath) return console.error(`Updater path not found. Files: ${files}`); | ||
|
||
const artifactPath = `${ARTIFACTS_DIR}/${UPDATER_ARTIFACT_NAME}.${ext}`; | ||
|
||
// https://tauri.app/v1/guides/distribution/updater#update-artifacts | ||
await io.cp(updaterPath, artifactPath); | ||
await io.cp(`${updaterPath}.sig`, `${artifactPath}.sig`); | ||
|
||
await client.uploadArtifact( | ||
UPDATER_ARTIFACT_NAME, | ||
[artifactPath, `${artifactPath}.sig`], | ||
ARTIFACTS_DIR | ||
); | ||
} | ||
|
||
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}`); | ||
|
||
const artifactName = `${ARTIFACT_BASE}.${ext}`; | ||
const artifactPath = `${ARTIFACTS_DIR}/${artifactName}`; | ||
|
||
await io.cp(standalonePath, artifactPath, { recursive: true }); | ||
await client.uploadArtifact(artifactName, [artifactPath], ARTIFACTS_DIR); | ||
} | ||
|
||
async function run() { | ||
await io.mkdirP(ARTIFACTS_DIR); | ||
|
||
const { updater, standalone } = OS_TARGETS[OS]; | ||
|
||
await uploadUpdater(updater); | ||
|
||
for (const config of standalone) { | ||
await uploadStandalone(config); | ||
} | ||
} | ||
run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"build": "ncc build index.ts --minify" | ||
}, | ||
"dependencies": { | ||
"@actions/artifact": "^1.1.2", | ||
"@actions/core": "^1.10.1", | ||
"@actions/github": "^6.0.0", | ||
"@actions/glob": "^0.4.0", | ||
"@actions/io": "^1.1.3" | ||
}, | ||
"devDependencies": { | ||
"@vercel/ncc": "^0.38.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es2015" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, | ||
"module": "esnext" /* Specify what module code is generated. */, | ||
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */, | ||
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, | ||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, | ||
"strict": true /* Enable all strict type-checking options. */, | ||
"skipLibCheck": true /* Skip type checking all .d.ts files. */ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
b27c5ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
spacedrive-landing – ./apps/landing
spacedrive-landing-git-main-spacedrive.vercel.app
spacedrive-landing-spacedrive.vercel.app
www.spacedrive.com
spacedrive-landing.vercel.app
spacedrive.com