Skip to content

Commit 7fc7080

Browse files
committed
修复工作流打包
1 parent 4ad4737 commit 7fc7080

2 files changed

Lines changed: 38 additions & 4 deletions

File tree

.github/workflows/tauri-release-sign.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,26 @@ on:
1111
required: false
1212
type: boolean
1313
default: true
14+
push:
15+
tags:
16+
- '*'
1417
permissions:
1518
contents: write
1619

1720
jobs:
21+
create_release:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Create or update draft release
26+
uses: softprops/action-gh-release@v2
27+
with:
28+
draft: ${{ inputs.draft }}
29+
tag_name: ${{ inputs.tag_name }}
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1832
build-matrix:
33+
needs: create_release
1934
strategy:
2035
matrix:
2136
os: [macos-latest, windows-latest]
@@ -37,9 +52,11 @@ jobs:
3752
- name: Set app version from input tag
3853
shell: bash
3954
env:
40-
TAG_NAME: ${{ inputs.tag_name }}
55+
INPUT_TAG: ${{ inputs.tag_name }}
56+
REF_TAG: ${{ github.ref_name }}
57+
SIGNING_IDENTITY: ${{ secrets.MAC_SIGNING_IDENTITY }}
4158
run: |
42-
node -e "const fs=require('fs'),p=require('path');const tag=process.env.TAG_NAME||'';const ver=tag.replace(/^v/i,'').replace(/^V/i,'');const sdir=p.join('desktop','tauri','src-tauri');const conf=p.join(sdir,'tauri.conf.json');fs.mkdirSync(sdir,{recursive:true});let obj;if(fs.existsSync(conf)){try{obj=JSON.parse(fs.readFileSync(conf,'utf8'))}catch(e){obj=null}}if(!obj){obj={\"$schema\":\"https://schema.tauri.app/config/2\",productName:'说说笔记',version:ver||'0.0.0',identifier:'cn.noisework.saynote',build:{devUrl:'http://localhost:1314',frontendDist:'../dist'},app:{windows:[{title:'说说笔记',width:1280,height:800}]},bundle:{active:true,targets:['dmg','nsis'],icon:['icons/icon.ico','icons/icon-128.png','icons/icon-256.png','icons/icon-512.png'],resources:['icons/favicon.svg','public','data/noise.db','config'],externalBin:['bin/server'],windows:{nsis:{}},macOS:{hardenedRuntime:false,minimumSystemVersion:'10.13',signingIdentity:null}},plugins:{updater:{active:false}}}};obj.version=ver||obj.version||'0.0.0';if(!obj.build)obj.build={};obj.build.frontendDist=obj.build.frontendDist||'../dist';fs.writeFileSync(conf,JSON.stringify(obj,null,2));console.log('Version set',{tag,ver,conf});"
59+
node -e "const fs=require('fs'),p=require('path');const tag=(process.env.INPUT_TAG||process.env.REF_TAG||'');const ver=tag.replace(/^v/i,'').replace(/^V/i,'');const id=process.env.SIGNING_IDENTITY||null;const sdir=p.join('desktop','tauri','src-tauri');const conf=p.join(sdir,'tauri.conf.json');fs.mkdirSync(sdir,{recursive:true});let obj;if(fs.existsSync(conf)){try{obj=JSON.parse(fs.readFileSync(conf,'utf8'))}catch(e){obj=null}}if(!obj){obj={\"$schema\":\"https://schema.tauri.app/config/2\",productName:'说说笔记',version:ver||'0.0.0',identifier:'cn.noisework.saynote',build:{devUrl:'http://localhost:1314',frontendDist:'../dist'},app:{windows:[{title:'说说笔记',width:1280,height:800}]},bundle:{active:true,targets:['dmg','nsis'],icon:['icons/icon.ico','icons/icon-128.png','icons/icon-256.png','icons/icon-512.png'],resources:['icons/favicon.svg','public','data/noise.db','config'],externalBin:['bin/server'],windows:{nsis:{}},macOS:{hardenedRuntime:!!id,minimumSystemVersion:'10.13',signingIdentity:id}},plugins:{updater:{active:false}}}};obj.version=ver||obj.version||'0.0.0';obj.bundle=obj.bundle||{};obj.bundle.macOS=obj.bundle.macOS||{};obj.bundle.macOS.signingIdentity=id;obj.bundle.macOS.hardenedRuntime=!!id;if(!obj.build)obj.build={};obj.build.frontendDist=obj.build.frontendDist||'../dist';fs.writeFileSync(conf,JSON.stringify(obj,null,2));console.log('Version set',{tag,ver,conf,id});"
4360
echo "DESKTOP_READY=true" >> "$GITHUB_ENV"
4461
- name: Bootstrap Tauri Rust skeleton if missing
4562
shell: bash

.github/workflows/tauri-release.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,26 @@ on:
1111
required: false
1212
type: boolean
1313
default: true
14+
push:
15+
tags:
16+
- '*'
1417
permissions:
1518
contents: write
1619

1720
jobs:
21+
create_release:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Create or update draft release
26+
uses: softprops/action-gh-release@v2
27+
with:
28+
draft: ${{ inputs.draft }}
29+
tag_name: ${{ inputs.tag_name }}
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1832
tauri:
33+
needs: create_release
1934
strategy:
2035
matrix:
2136
platform: [macos-latest, windows-latest]
@@ -34,9 +49,11 @@ jobs:
3449
- name: Set app version from input tag
3550
shell: bash
3651
env:
37-
TAG_NAME: ${{ inputs.tag_name }}
52+
INPUT_TAG: ${{ inputs.tag_name }}
53+
REF_TAG: ${{ github.ref_name }}
54+
SIGNING_IDENTITY: ${{ secrets.MAC_SIGNING_IDENTITY }}
3855
run: |
39-
node -e "const fs=require('fs'),p=require('path');const tag=process.env.TAG_NAME||'';const ver=tag.replace(/^v/i,'').replace(/^V/i,'');const sdir=p.join('desktop','tauri','src-tauri');const conf=p.join(sdir,'tauri.conf.json');fs.mkdirSync(sdir,{recursive:true});let obj;if(fs.existsSync(conf)){try{obj=JSON.parse(fs.readFileSync(conf,'utf8'))}catch(e){obj=null}}if(!obj){obj={\"$schema\":\"https://schema.tauri.app/config/2\",productName:'说说笔记',version:ver||'0.0.0',identifier:'cn.noisework.saynote',build:{devUrl:'http://localhost:1314',frontendDist:'../dist'},app:{windows:[{title:'说说笔记',width:1280,height:800}]},bundle:{active:true,targets:['dmg','nsis'],icon:['icons/icon.ico','icons/icon-128.png','icons/icon-256.png','icons/icon-512.png'],resources:['icons/favicon.svg','public','data/noise.db','config'],externalBin:['bin/server'],windows:{nsis:{}},macOS:{hardenedRuntime:false,minimumSystemVersion:'10.13',signingIdentity:null}},plugins:{updater:{active:false}}}};obj.version=ver||obj.version||'0.0.0';if(!obj.build)obj.build={};obj.build.frontendDist=obj.build.frontendDist||'../dist';fs.writeFileSync(conf,JSON.stringify(obj,null,2));console.log('Version set',{tag,ver,conf});"
56+
node -e "const fs=require('fs'),p=require('path');const tag=(process.env.INPUT_TAG||process.env.REF_TAG||'');const ver=tag.replace(/^v/i,'').replace(/^V/i,'');const id=process.env.SIGNING_IDENTITY||null;const sdir=p.join('desktop','tauri','src-tauri');const conf=p.join(sdir,'tauri.conf.json');fs.mkdirSync(sdir,{recursive:true});let obj;if(fs.existsSync(conf)){try{obj=JSON.parse(fs.readFileSync(conf,'utf8'))}catch(e){obj=null}}if(!obj){obj={\"$schema\":\"https://schema.tauri.app/config/2\",productName:'说说笔记',version:ver||'0.0.0',identifier:'cn.noisework.saynote',build:{devUrl:'http://localhost:1314',frontendDist:'../dist'},app:{windows:[{title:'说说笔记',width:1280,height:800}]},bundle:{active:true,targets:['dmg','nsis'],icon:['icons/icon.ico','icons/icon-128.png','icons/icon-256.png','icons/icon-512.png'],resources:['icons/favicon.svg','public','data/noise.db','config'],externalBin:['bin/server'],windows:{nsis:{}},macOS:{hardenedRuntime:!!id,minimumSystemVersion:'10.13',signingIdentity:id}},plugins:{updater:{active:false}}}};obj.version=ver||obj.version||'0.0.0';obj.bundle=obj.bundle||{};obj.bundle.macOS=obj.bundle.macOS||{};obj.bundle.macOS.signingIdentity=id;obj.bundle.macOS.hardenedRuntime=!!id;if(!obj.build)obj.build={};obj.build.frontendDist=obj.build.frontendDist||'../dist';fs.writeFileSync(conf,JSON.stringify(obj,null,2));console.log('Version set',{tag,ver,conf,id});"
4057
echo "DESKTOP_READY=true" >> "$GITHUB_ENV"
4158
- name: Bootstrap Tauri Rust skeleton if missing
4259
shell: bash

0 commit comments

Comments
 (0)