Skip to content

Commit b1ae040

Browse files
committed
chore: add publisher (#19)
* chore: add publisher
1 parent 4647efc commit b1ae040

File tree

6 files changed

+117
-11
lines changed

6 files changed

+117
-11
lines changed

.electron-builder.config.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
'use strict';
2+
3+
module.exports = async function () {
4+
const config = {
5+
appId: 'electron.modules.sample',
6+
copyright: 'ElectronModules',
7+
productName: 'ElectronModules',
8+
forceCodeSigning: false,
9+
asar: true,
10+
directories: {
11+
output: 'dist/'
12+
},
13+
linux: {
14+
target: 'deb',
15+
},
16+
nsis: {
17+
differentialPackage: false,
18+
publish: [
19+
{
20+
provider: 'github',
21+
},
22+
],
23+
},
24+
mac: {
25+
target: [
26+
{
27+
target: 'dmg',
28+
arch: ['x64', 'arm64'],
29+
},
30+
],
31+
publish: [
32+
{
33+
provider: 'github',
34+
},
35+
],
36+
icon: './assets/icon.png',
37+
},
38+
};
39+
return config;
40+
};

.github/workflows/release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '.github/**'
9+
- '!.github/workflows/ci.yml'
10+
- '!.github/workflows/release.yml'
11+
- '**.md'
12+
- .gitignore
13+
14+
concurrency:
15+
group: release-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
defaults:
19+
run:
20+
shell: 'bash'
21+
22+
jobs:
23+
draft_release:
24+
25+
permissions:
26+
contents: write # Allows this job to create releases
27+
28+
strategy:
29+
fail-fast: true
30+
matrix:
31+
# os: [ macos-latest, ubuntu-latest, windows-latest ]
32+
os: [ macos-latest, windows-latest ]
33+
# os: [ macos-latest ]
34+
35+
runs-on: ${{ matrix.os }}
36+
37+
steps:
38+
- name: Checkout Git Source
39+
uses: actions/checkout@v3
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v3
45+
46+
- name: Install dependencies
47+
run: npm install --force
48+
49+
- name: Build Package
50+
run: npm run build
51+
52+
- name: Compile artifacts and upload them to github release
53+
uses: nick-fields/retry@v2
54+
with:
55+
timeout_minutes: 15
56+
max_attempts: 3
57+
retry_wait_seconds: 15
58+
retry_on: error
59+
shell: 'bash'
60+
command: electron-builder build --config .electron-builder.config.js --publish always
61+
env:
62+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
63+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ fixtures/demo.app
66
*.sw*
77
*.un~
88
.electrom
9+
dist

.husky/pre-commit

Lines changed: 0 additions & 5 deletions
This file was deleted.

assets/icon.png

113 KB
Loading

package.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
22
"name": "electron-modules-sample",
3+
"version": "0.1.2",
34
"private": true,
45
"description": "electron modules sample",
56
"keywords": [
6-
"electron",
7-
"sample"
7+
"electron"
88
],
99
"repository": {
1010
"type": "git",
1111
"url": "git://github.com/electron-modules/electron-modules-sample.git"
1212
},
13+
"main": "./src/main.ts",
1314
"dependencies": {
1415
"@electron/remote": "2",
1516
"debug": "^4.3.4",
1617
"detect-port": "1",
1718
"electrom": "19",
18-
"electron": "19",
1919
"electron-json-storage-alt": "18",
2020
"electron-webview-schedule": "18",
2121
"electron-windows": "18",
@@ -41,14 +41,16 @@
4141
"cross-env": "^7.0.3",
4242
"dexie": "^3.2.3",
4343
"easy-i18n-cli": "1",
44+
"electron": "19",
45+
"electron-builder": "^24.6.4",
4446
"electron-installer-dmg": "^4.0.0",
4547
"eslint": "7",
4648
"eslint-config-egg": "^5.1.1",
4749
"eslint-plugin-mocha": "^4.11.0",
4850
"git-contributor": "*",
4951
"gulp": "^4.0.2",
5052
"gulp-nodemon": "^2.5.0",
51-
"husky": "^8.0.3",
53+
"husky": "4",
5254
"lint-staged": "^13.2.1",
5355
"mocha": "*",
5456
"monitor.js": "^2.0.1",
@@ -64,12 +66,17 @@
6466
"dev:watch": "gulp dev-app --watch",
6567
"test": "nyc --reporter=lcov --reporter=text mocha",
6668
"lint": "eslint . --fix",
69+
"build": "electron-builder build --config .electron-builder.config.js",
6770
"reset:db": "sh ./scripts/clean-db.sh",
6871
"translate": "easy-i18n-cli -c ./i18n.config.js",
6972
"translate:check": "npm run translate -- --check",
7073
"contributor": "git-contributor",
71-
"ss": "python3 -m http.server 8888",
72-
"prepare": "husky install"
74+
"ss": "python3 -m http.server 8888"
75+
},
76+
"husky": {
77+
"hooks": {
78+
"pre-commit": "npm run lint"
79+
}
7380
},
7481
"license": "MIT"
7582
}

0 commit comments

Comments
 (0)