diff --git a/.dockerignore b/.dockerignore index d7b4d0ec..dd56869e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -52,6 +52,7 @@ config.js # Distribution files dist/ +dist-pkg/ # Runtime files run/ diff --git a/.github/workflows/publish-rolling.yml b/.github/workflows/publish-rolling.yml index 5ce42d90..1c9cf285 100644 --- a/.github/workflows/publish-rolling.yml +++ b/.github/workflows/publish-rolling.yml @@ -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 diff --git a/.gitignore b/.gitignore index e4e0f08d..1fb8b5fe 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,7 @@ config.js # Distribution files dist/ +dist-pkg/ # Runtime files run/ diff --git a/.prettierignore b/.prettierignore index c3e0fb9a..e9fb1c38 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,6 @@ # Distribution files dist/ +dist-pkg/ # Coverage reports coverage/ diff --git a/README.md b/README.md index bda4879d..e2439b1f 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/package.json b/package.json index a0c63b53..2202a22c 100644 --- a/package.json +++ b/package.json @@ -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 .",