Revert "Revert "single executable support""

This reverts commit 970b2dd274.
This commit is contained in:
Jesse Chan
2020-11-15 23:26:35 +08:00
parent 1a878d5423
commit 3fb51e28b0
6 changed files with 63 additions and 0 deletions

View File

@@ -52,6 +52,7 @@ config.js
# Distribution files
dist/
dist-pkg/
# Runtime files
run/

View File

@@ -38,3 +38,48 @@ jobs:
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
pkg:
runs-on: ubuntu-latest
strategy:
matrix:
node: [15]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
- run: npm ci --no-optional
- run: sudo npm install -g pkg
- name: Tag rolling release
run: |
npm version --no-git-tag-version 0.0.0-master.`git rev-parse --short HEAD`
- name: Build executables
run: |
npm run build-pkg
- name: 'Upload executable: Linux'
uses: actions/upload-artifact@v2
with:
name: flood-linux
path: dist-pkg/flood-linux
- name: 'Upload executable: MacOS'
uses: actions/upload-artifact@v2
with:
name: flood-macos
path: dist-pkg/flood-macos
- name: 'Upload executable: Windows'
uses: actions/upload-artifact@v2
with:
name: flood-win
path: dist-pkg/flood-win.exe

1
.gitignore vendored
View File

@@ -49,6 +49,7 @@ config.js
# Distribution files
dist/
dist-pkg/
# Runtime files
run/

View File

@@ -1,5 +1,6 @@
# Distribution files
dist/
dist-pkg/
# Coverage reports
coverage/

View File

@@ -31,6 +31,8 @@ Install [Node.js runtime](https://nodejs.org/). Flood tracks `Current` and provi
- Debian, Ubuntu and RHEL-based distributions users can install latest `nodejs` from [NodeSource](https://github.com/nodesource/distributions) software repository.
- Windows and MacOS users may use installer.
**EXPERIMENTAL**: You can download a single-executable rolling build of Flood from [Github Actions](https://github.com/jesec/flood/actions?query=workflow%3A%22Publish+rolling+build%22). It bundles `Node.js` and supports `Linux`, `MacOS` and `Windows`.
### Installation
`sudo npm i -g flood` or `npx flood`

View File

@@ -27,11 +27,24 @@
"bin": {
"flood": "dist/index.js"
},
"pkg": {
"assets": [
"dist/assets/**/*",
"dist/geoip-country.dat",
"dist/geoip-country6.dat"
],
"targets": [
"node14-linux-x64",
"node14-macos-x64",
"node14-win-x64"
]
},
"scripts": {
"build": "npm run build-assets && npm run build-ts",
"build-assets": "node client/scripts/build.js",
"build-ts": "ncc build server/bin/start.ts -m -t -e geoip-country",
"build-i18n": "formatjs compile --ast --format simple client/src/javascript/i18n/strings.json --out-file client/src/javascript/i18n/strings.compiled.json && formatjs compile-folder --ast --format simple client/src/javascript/i18n/translations client/src/javascript/i18n/compiled",
"build-pkg": "rm -rf dist && npm run build && pkg . --out-path dist-pkg",
"format-source": "prettier -w .",
"check-compiled-i18n": "npm run build-i18n && npm run format-source && git diff --quiet client/src/javascript/i18n/compiled",
"check-source-formatting": "prettier -c .",