Deployment
Relevant source files
The following files were used as context for generating this wiki page:The deployment system for Skid-Inc is an automated process responsible for packaging the built application artifacts, generating verification data, and preparing them for distribution. This process is primarily managed by the deploy.js script, which collects distributable files from the build output, creates checksums, generates release notes and a manifest file, and archives everything for a new release.
The entire release pipeline, from building the application for multiple platforms to deploying the artifacts, can be triggered with a single command. The system is designed to produce a structured set of files for each version, ready to be uploaded to a distribution platform like GitHub Releases, which also feeds into the application's auto-update system.
Sources: scripts/deploy.js, scripts/README.md
Deployment Process
The deployment process is initiated after the application has been successfully built for all target platforms using the build-all.js script. The deploy.js script then orchestrates the collection and packaging of these build artifacts.
The following diagram illustrates the high-level deployment flow.
Core Components
DeployManager Class
The DeployManager class, located in scripts/deploy.js, is the central component of the deployment script. It encapsulates all logic for handling the deployment process. Upon instantiation, it reads package.json to determine the current application version, which is used to tag the release.
Sources: scripts/deploy.js:31-250
This diagram shows the structure of the DeployManager class and its main methods.
Sources: scripts/deploy.js:31-250
Build System (build-all.js)
Before deployment can occur, the application must be built. The build-all.js script automates this process using electron-builder. It supports multi-platform builds, includes error handling with retries, and generates a build report. The output of this script, located in the dist directory, serves as the input for the deploy.js script.
Sources: scripts/build-all.js, scripts/README.md:7-25
NPM Scripts
Several NPM scripts defined in package.json facilitate the build and deployment process.
| Script | Description | Source File |
|---|---|---|
build:automated | Runs the build/automated-build.js script (Note: scripts/build-all.js is a newer version). | package.json:28 |
build:release | An alias for build:automated intended for production releases. | package.json:29 |
deploy | Executes the build/deploy.js script (Note: scripts/deploy.js is a newer version). | package.json:30 |
deploy:github | Runs the deployment script with the github target. | package.json:31 |
release | A convenience script that chains the release build and GitHub deployment (npm run build:release && npm run deploy:github). | package.json:34 |
Sources: package.json:28-34, scripts/README.md:41-44
Deployment Configuration
Configuration for both the build and deployment processes is defined in scripts/deploy.js and package.json.
deploy.js Configuration
The DEPLOY_CONFIG object within scripts/deploy.js controls the behavior of the deployment script.
| Key | Description | Default Value -
| outputDir | The directory where build artifacts are located. | dist -
| releaseDir | The root directory where versioned release packages will be created. | releases -
| checksumAlgorithm | The hashing algorithm used for generating checksums. | sha256 -
| platforms | An object defining the file extensions for distributables on each OS. | { win: {...}, mac: {...}, linux: {...} } -
Sources: scripts/deploy.js:11-29, scripts/README.md:155-161
electron-builder Configuration
The build section in package.json contains the configuration for electron-builder, which dictates how the application is packaged.
"build": {
"appId": "com.totominc.skidinc",
"productName": "Skid-Inc",
"directories": {
"output": "dist",
"buildResources": "build"
},
"files": [
"src/**/*",
"app/**/*",
"index.html",
"icons/**/*",
"!**/*.md"
],
"win": {
"target": [ { "target": "portable", "arch": ["x64"] } ]
},
"mac": {
"target": [ { "target": "dmg", "arch": ["x64", "arm64"] }, { "target": "zip", "arch": ["x64", "arm64"] } ]
},
"linux": {
"target": [ { "target": "AppImage", "arch": ["x64"] }, { "target": "deb", "arch": ["x64"] }, { "target": "rpm", "arch": ["x64"] } ]
},
"publish": {
"provider": "github",
"owner": "TotomInc",
"repo": "skid-inc"
}
}
Key configurations include:
appId: The unique application identifier.directories.output: Specifies that build artifacts are placed in thedistdirectory.files: An array of files and directories to include in the final package.win,mac,linux: Platform-specific settings defining the target package types (e.g.,portable,dmg,AppImage).publish: Configures the provider for releases, pointing to the project's GitHub repository. This is essential for the auto-update functionality.
Sources: package.json:51-160
Generated Artifacts
After a successful run of the deployment script, a versioned directory is created inside releases/. This directory contains all files necessary for distribution.
Sources: scripts/README.md:47-55
The structure is as follows:
releases/v[version]/
├── [Platform executables and installers]
├── checksums.txt
├── [file].sha256
├── RELEASE_NOTES.md
├── manifest.json
└── skid-inc-[version]-release.zip
Sources: scripts/README.md:47-55
checksums.txt: A single file containing SHA256 hashes for all distributable files, used for integrity verification.RELEASE_NOTES.md: Automatically generated release notes with version information, installation instructions, and system requirements.manifest.json: A JSON file containing metadata about the release, including version, build date, and a list of artifacts with their checksums. This is used by the application's auto-update system.skid-inc-[version]-release.zip: A compressed archive containing all files in the release directory.
Sources: scripts/deploy.js:130-201
Release Manifest (manifest.json)
The generateManifest method in DeployManager creates a manifest.json file. This file is critical for providing metadata to external systems, such as an auto-updater.
// Example structure from deploy.js
const manifest = {
version: this.version,
releaseTag: this.releaseTag,
buildDate: new Date().toISOString(),
artifacts: [/* ... */],
systemRequirements: { /* ... */ },
downloadUrls: {
github: `https://github.com/TotomInc/skid-inc/releases/tag/%24%7Bthis.releaseTag%7D%60%2C
latest: "https://github.com/TotomInc/skid-inc/releases/latest%22
}
};
Sources: scripts/deploy.js:169-195
Post-Deployment: Auto-Update System
Once a new version is deployed to GitHub Releases, the in-app auto-update system can detect and install it. This is managed by the AutoUpdateManager class in src/auto-updater.js, which uses the electron-updater library.
The publish configuration in package.json tells electron-updater where to look for new releases. The updater checks for new versions on startup and periodically thereafter.
Sources: src/auto-updater.js:10-29, package.json:155-159
The following sequence diagram shows the update check process:
Conclusion
The deployment system for Skid-Inc provides a robust and automated pipeline for packaging and distributing the application. By combining electron-builder with custom Node.js scripts, the process ensures that each release is consistently structured with installers, verification data, and metadata. This structured output is not only convenient for manual distribution but also serves as the foundation for the integrated auto-update system, enabling seamless delivery of new versions to users.
Sources: scripts/deploy.js, scripts/README.md