-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add os agnostic build system (#34)
* feat: add windows support * build: add forge hook to copy assets (#42) * build: add forge hook to copy assets * ci: add forge publish workflow (#43) * ci: add forge publish workflow * build: download bee binary in forge hook (#44) * feat: add os agnostic pathfinder (#41) * fix: add function to test paths and fix hardcoded separators * fix: add makePath fn * chore: remove unused script * fix: fix more path issues * fix: make pathfinder stay in root directory * fix: add regex instead of sep * fix: do not prepend / on windows * fix: update binary links * refactor: improve path handling * build: add rimraf * chore: add clean script * build(fix): ignore publisher dependency * build(fix): ignore additional devDependencies * chore: use .depcheckrc * chore: use clean script instead of duplicating rimraf Co-authored-by: Cafe137 <aron@aronsoos.com>
- Loading branch information
Showing
13 changed files
with
748 additions
and
270 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
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,48 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
publish_on_linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@master | ||
with: | ||
node-version: 14 | ||
- name: install dependencies | ||
run: npm install | ||
- name: publish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npm run publish | ||
|
||
publish_on_mac: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@master | ||
with: | ||
node-version: 14 | ||
- name: install dependencies | ||
run: npm install | ||
- name: publish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npm run publish | ||
|
||
publish_on_win: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@master | ||
with: | ||
node-version: 14 | ||
- name: install dependencies | ||
run: npm install | ||
- name: publish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npm run publish |
This file was deleted.
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,42 @@ | ||
const { existsSync, writeFileSync } = require('fs') | ||
const { copySync } = require('fs-extra') | ||
const { join } = require('path') | ||
const { platform } = require('os') | ||
const { default: fetch } = require('node-fetch') | ||
const { execSync } = require('child_process') | ||
|
||
const binaries = { | ||
darwin: ['https://github.com/ethersphere/bee/releases/download/v1.5.1/bee-darwin-amd64', 'bee'], | ||
linux: ['https://github.com/ethersphere/bee/releases/download/v1.5.1/bee-linux-amd64', 'bee'], | ||
win32: ['https://github.com/ethersphere/bee/releases/download/v1.5.1/bee-windows-amd64.exe', 'bee.exe'], | ||
} | ||
|
||
module.exports = { | ||
generateAssets: async () => { | ||
const target = binaries[platform()] | ||
if (!existsSync(target[1])) { | ||
await downloadFile(target[0], target[1]) | ||
try { | ||
execSync(`chmod +x ${target[1]}`) | ||
} catch {} | ||
} | ||
}, | ||
postPackage: (_, options) => { | ||
if (existsSync('bee')) { | ||
copySync('bee', join(options.outputPaths[0], 'bee')) | ||
} | ||
if (existsSync('bee.exe')) { | ||
copySync('bee.exe', join(options.outputPaths[0], 'bee.exe')) | ||
} | ||
copySync('tray.png', join(options.outputPaths[0], 'tray.png')) | ||
copySync('tray@2x.png', join(options.outputPaths[0], 'tray@2x.png')) | ||
copySync('icon.png', join(options.outputPaths[0], 'icon.png')) | ||
copySync('static', join(options.outputPaths[0], 'static')) | ||
}, | ||
} | ||
|
||
function downloadFile(url, target) { | ||
return fetch(url) | ||
.then(x => x.arrayBuffer()) | ||
.then(x => writeFileSync(target, Buffer.from(x))) | ||
} |
Oops, something went wrong.