Skip to content

Commit

Permalink
deploy: add github action yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohaodu committed Apr 22, 2024
1 parent bc4d0ec commit 4ed21e7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Electron App Release Workflow

on:
push:
tags:
- "v*"

jobs:
build-and-publish:
runs-on: windows-2022 # 或选择其他适合你项目的操作系统环境
env:
GITHUB_TOKEN: ${{ vars.REPO_NOEXPIRATION }}
ELECTRON_MIRROR: https://npmmirror.com/mirrors/electron/

steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Install Node.js and npm
uses: actions/[email protected]
with:
node-version: "18.18.1" # 使用与你的项目兼容的Node.js版本

- name: Install dependencies and rebuild native modules for Electron
run: npm ci

- name: Publish to GitHub Release using electron-builder
run: npm run publish # 这个命令将在本地运行electron-builder的发布流程,包括构建和发布到GitHub
6 changes: 5 additions & 1 deletion electron-builder.json5
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
*/
{
$schema: "https://raw.githubusercontent.com/electron-userland/electron-builder/master/packages/app-builder-lib/scheme.json",
appId: "appId",
asar: true,
productName: "window-nail",
nodeGypRebuild: true,
npmRebuild: true,
publish: {
provider: "github",
releaseType: "release",
},
directories: {
output: "release/${version}",
},
files: ["dist", "dist-electron", "build"],
mac: {
publish: ["github"],
icon: "public/nail-white.png",
target: ["dmg"],
artifactName: "${productName}-Mac-${version}-Installer.${ext}",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"description": "window-nail",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build && electron-builder",
"build": "vue-tsc && vite build && electron-builder --publish never",
"publish": "vue-tsc && vite build && electron-builder --publish always",
"preview": "vite preview",
"postinstall": "electron-builder install-app-deps"
},
Expand Down

0 comments on commit 4ed21e7

Please sign in to comment.