From c22fe86c46299f13f44180ce2b652f57d5a4e794 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sat, 10 Jul 2021 19:01:53 +0200 Subject: [PATCH] :sparkles: bundle exectuable --- .github/workflows/release.yml | 40 ++++++++++++++++++++++++++++++++++ .gitignore | 1 + package-lock.json | Bin 691230 -> 691326 bytes package.json | 7 +++--- src/Server.ts | 2 +- 5 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..893fd26c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +on: + workflow_dispatch: + push: + # Sequence of patterns matched against refs/tags + tags: + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Publish Release + +jobs: + build: + name: Publish Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build # This would actually build your project, using zip for an example artifact + run: | + npm install + npm run bundle + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: true + prerelease: true + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./build/api-linux + asset_name: server-api-linux + asset_content_type: application/x-binary diff --git a/.gitignore b/.gitignore index 628444bf..85ddc5c8 100644 --- a/.gitignore +++ b/.gitignore @@ -81,6 +81,7 @@ typings/ # Nuxt.js build / generate output .nuxt dist +build # Gatsby files .cache/ diff --git a/package-lock.json b/package-lock.json index abc73d469bad1a217b65ce7f742a7f9b8ec13ad2..3abd61b472669b0cfa54d967a7d6c90570fb596a 100644 GIT binary patch delta 536 zcmbO?L+jrRtqsx4jONqz&6u?|w=v5zP8Db8-MoqA+NA08Z!j89E?CVz-A9E@VEUp2 zHkHuC^pa#Z@5G`~AB&LOr zJntm8q%_k?!=bHRsmQr)g zjP{xtjN5BwFvZT9{GnTadQ=IA%5)}aPMOI9A}pclM#;WKrUj9fDdGM>xjrc+X6{A# zX0Anr;n}9?N&eZn!4XyNAsLzBNr{eL=Drc71*U=7rCuIM;fDUR_U%7a cIE?)1<@f1~>p5iF`Aa!~m~%USDHp#u031cQmjD0& delta 545 zcmex2Lu=j)tqsx4jHc5Q&6u?|w=v5zPXFG_!n=7B%e6_<1?(7Eru$#z)Svue4g2&u z6*htCj&s>nLW9eliV983lgzRr0u1tv{f)DNOHu;Dle`Nub3;6H(^A}A^!=k;jZ4F| zvohQZQi}C+Ov`;EEOXK#{X<;*6HT4+Q;Y(0{nPU;bMmxHd<%>s0`#X})MwI~>@bm| zdHsy`^)nc^ub;sbGiSOtC%gW1D^q5b>0d$^Wu`0aVr30UO7b@}^-2#&&n?Ui4tA?3 z_73wYcXCc~^(`|EGw^pZj!cWJau4>=uJBCOPBwNb@b)eU3v?+l%1B8ni;OHU$|~|G z39$?aFG&gV^vW_#4zviKUYNnC(Eiz!8Hic7e>Pi(ec7k88Py diff --git a/package.json b/package.json index b40459b1..84a71836 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "start": "npm run build && node dist/start", "build": "tsc -b .", "dev": "tsnd --respawn src/start.ts", - "bundle": "npm run build && pkg package.json" + "bundle": "npm run build && pkg --no-bytecode --public-packages=* package.json" }, "pkg": { "scripts": [ @@ -19,7 +19,8 @@ ], "assets": [ "locales", - "assets" + "assets", + "client_test" ], "targets": [ "latest-linux-x64", @@ -67,7 +68,7 @@ "i18next-node-fs-backend": "^2.1.3", "image-size": "^1.0.0", "jsonwebtoken": "^8.5.1", - "lambert-server": "^1.2.5", + "lambert-server": "^1.2.7", "missing-native-js-functions": "^1.2.6", "mongoose": "^5.12.3", "mongoose-autopopulate": "^0.12.3", diff --git a/src/Server.ts b/src/Server.ts index 1a814f10..a1b51d21 100644 --- a/src/Server.ts +++ b/src/Server.ts @@ -105,7 +105,7 @@ export class FosscordServer extends Server { app.use("/api/v9", prefix); this.app = app; this.app.use(ErrorHandler); - const indexHTML = await fs.readFile(path.join(__dirname, "..", "client_test", "index.html"), { encoding: "utf8" }); + const indexHTML = fs.readFileSync(path.join(__dirname, "..", "client_test", "index.html"), { encoding: "utf8" }); this.app.use("/assets", express.static(path.join(__dirname, "..", "assets")));