Skip to content

Commit f4da642

Browse files
committed
doc: updated docs
1 parent d93ed65 commit f4da642

File tree

3 files changed

+151
-0
lines changed

3 files changed

+151
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
# How to use this tool
44
1. Copy this tool to `build-src/win` folder in your Tauri project
55
2. copy `copysigntool` https://github.com/phcode-dev/copySignTool also to `build-src/win` folder in your Tauri project
6+
3. copy workflow script from `example/sample.yaml`
7+
4. Put all credentials a github secret refer `example/ev_variables.png`

example/ev_variables.png

20.4 KB
Loading

example/sample.yaml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: 'publish'
2+
3+
on: pull_request
4+
5+
jobs:
6+
create-release:
7+
permissions:
8+
contents: write
9+
runs-on: ubuntu-20.04
10+
outputs:
11+
release_id: ${{ steps.create-release.outputs.result }}
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: setup node
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: lts/*
19+
- name: create release
20+
id: create-release
21+
uses: actions/github-script@v6
22+
with:
23+
script: |
24+
const { data } = await github.rest.repos.createRelease({
25+
owner: context.repo.owner,
26+
repo: context.repo.repo,
27+
tag_name: `app-v${process.env.PACKAGE_VERSION}`,
28+
name: `Desktop App v${process.env.PACKAGE_VERSION}`,
29+
body: 'Take a look at the assets to download and install this app.',
30+
draft: true,
31+
prerelease: false
32+
})
33+
return data.id
34+
35+
build-tauri:
36+
needs: create-release
37+
permissions:
38+
contents: write
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
platform: [ macos-latest, ubuntu-20.04, windows-latest ]
43+
44+
runs-on: ${{ matrix.platform }}
45+
steps:
46+
- uses: actions/checkout@v3
47+
- name: setup node
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: lts/*
51+
- name: install Rust stable
52+
uses: dtolnay/rust-toolchain@stable
53+
- name: install dependencies (ubuntu only)
54+
if: matrix.platform == 'ubuntu-20.04'
55+
run: |
56+
sudo apt-get update
57+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
58+
- name: install frontend dependencies
59+
run: npm install # change this to npm or pnpm depending on which one you use
60+
- name: install AzureSignTool (windows only)
61+
if: matrix.platform == 'windows-latest'
62+
run: |
63+
dotnet tool install --global AzureSignTool
64+
- name: import certificate for signing (windows only)
65+
if: matrix.platform == 'windows-latest'
66+
run: |
67+
echo "${{ secrets.AZURE_EV_CERT }}" > secret.cer
68+
Import-Certificate -FilePath .\secret.cer -CertStoreLocation Cert:\LocalMachine\My
69+
shell: powershell
70+
- name: patch signTool (windows only)
71+
if: matrix.platform == 'windows-latest'
72+
run: Start-Process -FilePath .\src-build\win\copy_sign_tool.exe -Verb RunAs
73+
shell: powershell
74+
- name: setup env for signing (windows only)
75+
if: matrix.platform == 'windows-latest'
76+
env:
77+
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
78+
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
79+
AZURE_KEY_VAULT_URI: ${{ secrets.AZURE_KEY_VAULT_URI }}
80+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
81+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
82+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
83+
AZURE_CERT_NAME: ${{ secrets.AZURE_CERT_NAME }}
84+
AZURE_COMPANY_NAME: ${{ secrets.AZURE_COMPANY_NAME }}
85+
run: |
86+
$jsonContent = @{
87+
"AZURE_KEY_VAULT_URI" = $env:AZURE_KEY_VAULT_URI
88+
"AZURE_CLIENT_ID" = $env:AZURE_CLIENT_ID
89+
"AZURE_TENANT_ID" = $env:AZURE_TENANT_ID
90+
"AZURE_CLIENT_SECRET" = $env:AZURE_CLIENT_SECRET
91+
"AZURE_CERT_NAME" = $env:AZURE_CERT_NAME
92+
"AZURE_COMPANY_NAME" = $env:AZURE_COMPANY_NAME
93+
}
94+
$jsonContent | ConvertTo-Json | Out-File -FilePath ./secrets.json -Encoding utf8
95+
# Load content from the file
96+
$content = Get-Content -Path "./secrets.json" -Raw
97+
98+
# Replace \r\n with \n
99+
$content = $content -replace "`r`n", "`n"
100+
101+
# Write the content back to the file
102+
Set-Content -Path "./secrets.json" -Value $content
103+
shell: powershell
104+
- uses: tauri-apps/tauri-action@v0
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
108+
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
109+
with:
110+
releaseId: ${{ needs.create-release.outputs.release_id }}
111+
112+
- name: setup env for mac arm (Mac only)
113+
if: matrix.platform == 'macos-latest'
114+
run: |
115+
rustup target add aarch64-apple-darwin
116+
npm run installNodeArmDarwin
117+
- name: build for mac arm (Mac only)
118+
if: matrix.platform == 'macos-latest'
119+
uses: tauri-apps/tauri-action@v0
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
123+
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
124+
with:
125+
releaseId: ${{ needs.create-release.outputs.release_id }}
126+
args: --target aarch64-apple-darwin
127+
128+
129+
publish-release:
130+
permissions:
131+
contents: write
132+
runs-on: ubuntu-20.04
133+
needs: [ create-release, build-tauri ]
134+
135+
steps:
136+
- name: publish release
137+
id: publish-release
138+
uses: actions/github-script@v6
139+
env:
140+
release_id: ${{ needs.create-release.outputs.release_id }}
141+
with:
142+
script: |
143+
github.rest.repos.updateRelease({
144+
owner: context.repo.owner,
145+
repo: context.repo.repo,
146+
release_id: process.env.release_id,
147+
draft: true,
148+
prerelease: false
149+
})

0 commit comments

Comments
 (0)