Skip to content

Commit

Permalink
重构代码
Browse files Browse the repository at this point in the history
  • Loading branch information
12Tall committed Oct 11, 2021
1 parent a9e2c6a commit 85f7e63
Show file tree
Hide file tree
Showing 10 changed files with 370 additions and 193 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: build_yan_for_windows
on:
push:
branches:
- "master"
jobs:
release-all:
name: release
needs: [build-win]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# 读取json 文件的属性
- name: Read Properties
id: version # step_id 在后面会用到
uses: ashley-taylor/[email protected]
with:
path: ./web_src/package.json # 文件路径
property: version # 相应的字段
- name: create release
id: create_release
uses: actions/create-release@master
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
# 根据版本号打标签
tag_name: v${{steps.version.outputs.value}}
release_name: Release v${{steps.version.outputs.value}}
draft: false
prerelease: false
- uses: actions/download-artifact@v2
with:
name: release
- name: upload win
id: upload-windows
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./yan-win.zip
asset_name: yan-win.zip
asset_content_type: application/zip

build-win:
name: build for windows
runs-on: windows-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: install node/npm
uses: actions/setup-node@v2
with:
node-version: '14'
- name: build
# 编译后在根目录生成index.node
run: |
npm install -g yarn
cd web_src
yarn
yarn run build
npm uninstall -g yarn
cd ../
cargo build --release
- name: zip windows artifact
run: |
powershell Compress-Archive ./target/release/yan.exe yan-win.zip
- uses: actions/upload-artifact@v2
with:
name: release
path: ./yan-win.zip
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
web/
target/
target/
yan.exe
74 changes: 50 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "yan"
version = "0.1.0"
edition = "2018"

[build]
target-dir = "../output"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "yan" # bin 文件不要与lib 文件重名
Expand All @@ -13,6 +16,7 @@ name = "libyan"
crate-type = ["staticlib", "cdylib"]

[dependencies]
single-instance = "0.3.2"
wry = "0.12.2"
rfd = "0.5.0"
include_dir = "0.6.2"
Expand Down
Loading

0 comments on commit 85f7e63

Please sign in to comment.