Skip to content

Commit 4815f86

Browse files
committed
add action for building
1 parent 26d9d3f commit 4815f86

File tree

6 files changed

+93
-6
lines changed

6 files changed

+93
-6
lines changed

.github/workflows/build.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Publish Application
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
8+
jobs:
9+
publish-tauri:
10+
permissions:
11+
contents: write
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- platform: "macos-latest"
17+
args: "--target aarch64-apple-darwin"
18+
- platform: "macos-latest"
19+
args: "--target x86_64-apple-darwin"
20+
- platform: "ubuntu-22.04"
21+
args: ""
22+
- platform: "windows-latest"
23+
args: ""
24+
runs-on: ${{ matrix.platform }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: install dependencies (ubuntu only)
29+
if: matrix.platform == 'ubuntu-22.04'
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
33+
34+
- name: setup node
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: lts/*
38+
cache: "npm"
39+
40+
- name: install Rust stable
41+
uses: dtolnay/rust-toolchain@stable
42+
with:
43+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
44+
45+
- name: Rust cache
46+
uses: swatinem/rust-cache@v2
47+
with:
48+
workspaces: "./bridge -> target"
49+
50+
- name: install frontend dependencies
51+
run: npm install
52+
53+
- uses: tauri-apps/tauri-action@v0
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
tagName: app-v__VERSION__
58+
releaseName: "App v__VERSION__"
59+
releaseBody: "See the assets to download this version and install."
60+
releaseDraft: true
61+
prerelease: false
62+
args: ${{ matrix.args }}

bridge/tauri.conf.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "HTTP Interceptor",
4-
"version": "0.1.0",
4+
"version": "0.1.3",
55
"identifier": "com.http-interceptor.app",
66
"build": {
77
"beforeDevCommand": "npm run dev",
88
"devUrl": "http://localhost:1420",
9-
"beforeBuildCommand": "npm run build",
9+
"beforeBuildCommand": "npm run build:ui",
1010
"frontendDist": "../dist"
1111
},
1212
"app": {
@@ -33,4 +33,4 @@
3333
"icons/icon.ico"
3434
]
3535
}
36-
}
36+
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc && vite build",
8+
"build:ui": "tsc && vite build",
99
"preview": "vite preview",
10-
"tauri": "tauri"
10+
"tauri": "tauri",
11+
"update-version": "tsx scripts/update-version.ts"
1112
},
1213
"dependencies": {
1314
"@phosphor-icons/react": "^2.1.10",

scripts/update-version.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import fs from 'fs';
2+
3+
import { FgGreen } from './util';
4+
5+
async function main() {
6+
const tauriConf = JSON.parse(fs.readFileSync('./bridge/tauri.conf.json', 'utf-8'));
7+
const version = tauriConf.version;
8+
const parts = version.split('.');
9+
parts[2] = (Number(parts[2]) + 1).toString();
10+
tauriConf.version = parts.join('.');
11+
fs.writeFileSync('./bridge/tauri.conf.json', JSON.stringify(tauriConf, null, 2));
12+
console.log(`${FgGreen}Updated version to ${tauriConf.version}`);
13+
}
14+
15+
main();

scripts/util/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const FgBlack = '\x1b[30m';
2+
export const FgRed = '\x1b[31m';
3+
export const FgGreen = '\x1b[32m';
4+
export const FgYellow = '\x1b[33m';
5+
export const FgBlue = '\x1b[34m';
6+
export const FgMagenta = '\x1b[35m';
7+
export const FgCyan = '\x1b[36m';
8+
export const FgWhite = '\x1b[37m';
9+
export const FgGray = '\x1b[90m';

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
"@interceptor/*": ["interceptor/*"]
2828
}
2929
},
30-
"include": ["ui", "shared", "interceptor"],
30+
"include": ["ui", "shared", "interceptor", "scripts"],
3131
"references": [{ "path": "./tsconfig.node.json" }]
3232
}

0 commit comments

Comments
 (0)