Skip to content

Commit

Permalink
chore: ready for production
Browse files Browse the repository at this point in the history
  • Loading branch information
ResetPower committed Aug 9, 2021
1 parent 73ccbf0 commit 6e49d3d
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 8 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: release

on:
workflow_dispatch:
tags:
- "v*.*.*"
inputs:
title:
description: "Title of the release"
required: true
default: "Epherome vX.X.X"
content:
description: "Content of the release"
required: true
default: "New version of epherome"

jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
run: npm install
- name: Webpack Build Production
run: npm run prod
- name: Electron Build Package (Linux)
run: npm run package -- --linux
- name: Electron Build Package (macOS)
run: npm run package -- --macos
- name: Electron Build Package (Windows)
run: npm run package -- --windows
- name: GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: ${{ github.event.tags }}
name: ${{ github.event.input.title }}
body: ${{ github.event.input.content }}
draft: true
prerelease: true
files: |
package/Epherome-${{ github.event.tags }}.exe
package/Epherome-${{ github.event.tags }}.dmg
package/Epherome-${{ github.event.tags }}.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"productName": "Epherome",
"copyright": "Copyright (C) 2021 ResetPower.",
"artifactName": "Epherome-${version}.${ext}",
"artifactName": "Epherome-v${version}.${ext}",
"directories": {
"output": "package"
},
Expand All @@ -40,8 +40,7 @@
"target": "portable"
},
"mac": {
"target": "dmg",
"category": ""
"target": "dmg"
},
"linux": {
"target": "tar.gz"
Expand Down
2 changes: 1 addition & 1 deletion src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ClientJson, ClientJsonArguments, mergeClientJson } from "./struct";
import { isCompliant, osName } from "./rules";
import { unzipNatives } from "./unzip";
import { runMinecraft } from "./runner";
import { createDirIfNotExist, downloadFile } from "./stream";
import { createDirIfNotExist, downloadFile } from "../models/files";
import { DefaultFn } from "../tools";
import {
isJava16Required,
Expand Down
2 changes: 1 addition & 1 deletion src/core/libraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ClientJsonLibraries,
ClientLibraryResult,
} from "./struct";
import { downloadFile } from "./stream";
import { downloadFile } from "../models/files";
import { MinecraftUrlUtils } from "../craft/url";

export async function analyzeLibrary(
Expand Down
2 changes: 2 additions & 0 deletions src/core/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export function runMinecraft(
const raw = spawn(java, buff, {
cwd: dir,
});
raw.stdout.setEncoding("utf-8");
raw.stderr.setEncoding("utf-8");
raw.stdout.on(
"data",
() =>
Expand Down
2 changes: 1 addition & 1 deletion src/craft/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { configStore, minecraftDownloadPath } from "../struct/config";
import { DefaultFn, ErrorHandler } from "../tools";
import { ClientJson } from "../core/struct";
import { analyzeAssets, analyzeLibrary } from "../core/libraries";
import { createDirByPath } from "../core/stream";
import { createDirByPath } from "../models/files";
import { logger } from "../renderer/global";
import { Downloader, DownloaderDetailsListener } from "../models/downloader";
import { MinecraftUrlUtils } from "./url";
Expand Down
2 changes: 1 addition & 1 deletion src/models/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import got from "got";
import path from "path";
import fs, { WriteStream } from "fs";
import { DefaultFn, ErrorHandler, unwrapFunction } from "../tools";
import { createDirByPath } from "../core/stream";
import { createDirByPath } from "../models/files";
import { pipeline } from "stream";

export type DownloaderDetailsListener = (
Expand Down
6 changes: 6 additions & 0 deletions src/core/stream.ts → src/models/files.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from "fs";
import got from "got";
import path from "path";
import crypto from "crypto";
import { DefaultFn, unwrapFunction } from "../tools";

export function createDirIfNotExist(p: string): void {
Expand Down Expand Up @@ -30,3 +31,8 @@ export function downloadFile(
downloadStream.pipe(fileStream);
});
}

export function calculateHash(file: string): string {
const data = fs.readFileSync(file);
return crypto.createHash("sha1").update(data).digest("hex");
}
2 changes: 1 addition & 1 deletion src/views/ProcessesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const ProcessesPage = observer(() => {
<CSSTransition timeout={300} classNames="tab-vertical" key={selected}>
<div
ref={onScrollPaneLoaded}
className="w-3/4 overflow-y-scroll text-contrast rounded-lg bg-card shadow-md m-6"
className="overflow-y-scroll w-3/4 text-contrast rounded-lg bg-card shadow-md m-6"
>
<div className="px-3 h-12 flex items-center top-0 shadow-sm sticky z-10 bg-card">
<Button
Expand Down

0 comments on commit 6e49d3d

Please sign in to comment.