-
-
Notifications
You must be signed in to change notification settings - Fork 155
101 lines (86 loc) · 3.44 KB
/
publish.yml
File metadata and controls
101 lines (86 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: "publish"
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "windows-latest"
args: ""
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./app/src-tauri -> target"
- name: install frontend dependencies
working-directory: ./app
run: npm install
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
with:
projectPath: ./app
tagName: ${{ github.ref_name }}
releaseName: ${{ github.ref_name }}
releaseBody: "*The desktop app may be flagged as a threat by Windows Defender; however, this is a false positive. This occurs because the scripts you create with WinScript can modify system settings. Rest assured, WinScript is safe, transparent, and open-source.*"
includeUpdaterJson: true
updaterJsonPreferNsis: true
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
- name: Wait for release
run: |
sleep 5
- name: Upload Portable Executable to Release
run: |
ren ./app/src-tauri/target/release/winscript.exe winscript-portable.exe
gh release upload ${{ github.ref_name }} ./app/src-tauri/target/release/winscript-portable.exe --clobber
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Rename installer file in releases (Windows)
shell: pwsh
run: |
$VERSION = "${{ github.ref_name }}" -replace "^v", ""
gh release download "${{ github.ref_name }}" -p "WinScript_${VERSION}_x64-setup.exe"
Rename-Item "WinScript_${VERSION}_x64-setup.exe" "winscript-installer.exe"
gh release upload "${{ github.ref_name }}" "winscript-installer.exe" --clobber
gh release delete-asset "${{ github.ref_name }}" "WinScript_${VERSION}_x64-setup.exe"
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Modify latest.json
shell: powershell
run: |
gh release download "${{ github.ref_name }}" -p "latest.json"
$content = Get-Content -Path "latest.json" -Raw
$modified = $content -replace 'WinScript_\d+\.\d+\.\d+_x64-setup\.exe', 'winscript-installer.exe'
$modified | Set-Content -Path "latest.json"
Get-Content -Path "latest.json"
gh release upload "${{ github.ref_name }}" "latest.json" --clobber
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
- name: Remove signature file
run: |
$VERSION = "${{ github.ref_name }}" -replace "^v", ""
gh release delete-asset "${{ github.ref_name }}" "WinScript_${VERSION}_x64-setup.exe.sig"
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}