Skip to content

Commit 5841567

Browse files
committed
feat: Initialize Gitea Mirror project with Tauri
- Added Cargo.toml for project configuration and dependencies. - Created build.rs for Tauri build process. - Defined default capabilities in default.json. - Added various icon files for application branding. - Implemented main application logic in src/lib.rs and src/main.rs. - Configured Tauri settings in tauri.conf.json, including build commands and window settings.
1 parent 38206e7 commit 5841567

30 files changed

+6562
-3
lines changed

.github/workflows/tauri-release.yml

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
name: "Tauri Release"
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish-tauri:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
platform: [macos-latest, ubuntu-20.04, windows-latest]
13+
include:
14+
- platform: macos-latest
15+
target: darwin-universal
16+
bundle_ext: dmg
17+
artifact_name: macOS
18+
- platform: ubuntu-20.04
19+
target: linux-x86_64
20+
bundle_ext: AppImage
21+
artifact_name: AppImage
22+
- platform: ubuntu-20.04
23+
target: linux-x86_64
24+
bundle_ext: deb
25+
artifact_name: Debian
26+
- platform: ubuntu-20.04
27+
target: linux-x86_64
28+
bundle_ext: rpm
29+
artifact_name: RPM
30+
- platform: windows-latest
31+
target: windows-x86_64
32+
bundle_ext: msi
33+
artifact_name: Windows-MSI
34+
- platform: windows-latest
35+
target: windows-x86_64
36+
bundle_ext: exe
37+
artifact_name: Windows-EXE
38+
39+
runs-on: ${{ matrix.platform }}
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v3
43+
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v3
46+
with:
47+
node-version: 22
48+
cache: 'pnpm'
49+
50+
- name: Install pnpm
51+
uses: pnpm/action-setup@v2
52+
with:
53+
version: 8
54+
run_install: false
55+
56+
- name: Install Rust stable
57+
uses: dtolnay/rust-toolchain@stable
58+
with:
59+
targets: ${{ matrix.target }}
60+
61+
# Install Linux dependencies
62+
- name: Install Linux dependencies
63+
if: matrix.platform == 'ubuntu-20.04'
64+
run: |
65+
sudo apt-get update
66+
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev
67+
68+
# Install macOS dependencies
69+
- name: Install macOS dependencies
70+
if: matrix.platform == 'macos-latest'
71+
run: |
72+
rustup target add aarch64-apple-darwin
73+
74+
# Install Windows dependencies
75+
- name: Install Windows dependencies
76+
if: matrix.platform == 'windows-latest'
77+
run: |
78+
# No additional dependencies needed for Windows
79+
80+
- name: Install dependencies
81+
run: pnpm install
82+
83+
# Build the app for the specific target
84+
- name: Build Tauri app
85+
uses: tauri-apps/tauri-action@v0
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
89+
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
90+
with:
91+
tagName: ${{ github.ref_name }}
92+
releaseName: "Gitea Mirror v__VERSION__"
93+
releaseBody: "See the assets to download this version and install."
94+
releaseDraft: false
95+
prerelease: false
96+
args: --target ${{ matrix.target }}
97+
98+
# Upload the specific bundle to the GitHub release
99+
- name: Upload Release Asset
100+
uses: actions/upload-release-asset@v1
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
with:
104+
upload_url: ${{ github.event.release.upload_url }}
105+
asset_path: ./src-tauri/target/release/bundle/${{ matrix.bundle_ext }}/Gitea*.${{ matrix.bundle_ext }}
106+
asset_name: gitea-mirror-${{ github.ref_name }}-${{ matrix.artifact_name }}.${{ matrix.bundle_ext }}
107+
asset_content_type: application/octet-stream
108+
109+
# Generate update manifest and update the release
110+
update-release:
111+
needs: publish-tauri
112+
runs-on: ubuntu-latest
113+
steps:
114+
- name: Checkout repository
115+
uses: actions/checkout@v3
116+
117+
- name: Setup Node.js
118+
uses: actions/setup-node@v3
119+
with:
120+
node-version: 22
121+
cache: 'pnpm'
122+
123+
- name: Install pnpm
124+
uses: pnpm/action-setup@v2
125+
with:
126+
version: 8
127+
run_install: false
128+
129+
- name: Download all artifacts
130+
uses: actions/download-artifact@v3
131+
with:
132+
path: artifacts
133+
134+
- name: Generate update manifest
135+
run: |
136+
# Extract version from tag (remove 'v' prefix if present)
137+
VERSION="${{ github.ref_name }}"
138+
VERSION="${VERSION#v}"
139+
140+
# Create directory structure
141+
mkdir -p src-tauri/target/release/bundle
142+
143+
# Move artifacts to the expected locations
144+
find artifacts -type f -name "*.deb" -exec cp {} src-tauri/target/release/bundle/ \;
145+
find artifacts -type f -name "*.rpm" -exec cp {} src-tauri/target/release/bundle/ \;
146+
find artifacts -type f -name "*.AppImage" -exec cp {} src-tauri/target/release/bundle/ \;
147+
find artifacts -type f -name "*.msi" -exec cp {} src-tauri/target/release/bundle/ \;
148+
find artifacts -type f -name "*.exe" -exec cp {} src-tauri/target/release/bundle/ \;
149+
find artifacts -type f -name "*.dmg" -exec cp {} src-tauri/target/release/bundle/ \;
150+
151+
# Generate the update manifest
152+
node scripts/generate-update-manifest.js "$VERSION" "Release $VERSION"
153+
154+
# Sign the update manifest if keys are available
155+
if [ -n "${{ secrets.TAURI_PRIVATE_KEY }}" ] && [ -n "${{ secrets.TAURI_KEY_PASSWORD }}" ]; then
156+
echo "${{ secrets.TAURI_PRIVATE_KEY }}" > tauri.key.pem
157+
pnpm tauri signer sign --password "${{ secrets.TAURI_KEY_PASSWORD }}" update.json
158+
rm tauri.key.pem
159+
fi
160+
161+
- name: Upload update manifest
162+
uses: actions/upload-release-asset@v1
163+
env:
164+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165+
with:
166+
upload_url: ${{ github.event.release.upload_url }}
167+
asset_path: ./update.json
168+
asset_name: update.json
169+
asset_content_type: application/json
170+
171+
- name: Update Release
172+
uses: softprops/action-gh-release@v1
173+
with:
174+
tag_name: ${{ github.ref_name }}
175+
name: "Gitea Mirror v${{ github.ref_name }}"
176+
body: |
177+
## Gitea Mirror v${{ github.ref_name }}
178+
179+
### Installation
180+
181+
Download the appropriate package for your operating system:
182+
183+
- **Windows**: `.exe` or `.msi` file
184+
- **macOS**: `.dmg` file
185+
- **Linux**: `.AppImage`, `.deb`, or `.rpm` file
186+
187+
### Automatic Updates
188+
189+
This release supports automatic updates. Your application will notify you when a new version is available.
190+
191+
### Changes in this release
192+
193+
${{ github.event.release.body }}
194+
draft: false
195+
prerelease: false
196+
env:
197+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<a href="https://github.com/arunavo4/gitea-mirror/releases/latest"><img src="https://img.shields.io/github/v/tag/arunavo4/gitea-mirror?label=release"/></a>
44
<a href="https://github.com/arunavo4/gitea-mirror/actions/workflows/astro-build-test.yml"><img src="https://img.shields.io/github/actions/workflow/status/arunavo4/gitea-mirror/astro-build-test.yml?branch=main"/></a>
55
<a href="https://github.com/arunavo4/gitea-mirror/pkgs/container/gitea-mirror"><img src="https://img.shields.io/badge/ghcr.io-container-blue?logo=github"/></a>
6+
<a href="https://github.com/arunavo4/gitea-mirror/releases/latest"><img src="https://img.shields.io/badge/Tauri-native_app-purple?logo=tauri"/></a>
67
<a href="https://github.com/arunavo4/gitea-mirror/blob/main/LICENSE"><img src="https://img.shields.io/github/license/arunavo4/gitea-mirror"/></a>
78
</p>
89

@@ -99,9 +100,23 @@ This will create the necessary tables. On first launch, you'll be guided through
99100

100101
### Installation
101102

102-
#### Using Docker (Recommended)
103+
#### Native Application Packages
103104

104-
Gitea Mirror provides multi-architecture Docker images that work on both ARM64 (e.g., Apple Silicon, Raspberry Pi) and x86_64 (Intel/AMD) platforms.
105+
Gitea Mirror is available as native application packages for Windows, macOS, and Linux:
106+
107+
- **Windows**: Download the `.exe` or `.msi` installer from the [latest release](https://github.com/arunavo4/gitea-mirror/releases/latest)
108+
- **macOS**: Download the `.dmg` file from the [latest release](https://github.com/arunavo4/gitea-mirror/releases/latest)
109+
- **Linux**: Download the `.AppImage`, `.deb`, or `.rpm` package from the [latest release](https://github.com/arunavo4/gitea-mirror/releases/latest)
110+
111+
Native packages provide a seamless desktop experience with:
112+
- System tray integration
113+
- Native notifications
114+
- Automatic updates
115+
- Offline capability
116+
117+
#### Using Docker (Alternative)
118+
119+
Gitea Mirror also provides multi-architecture Docker images that work on both ARM64 (e.g., Apple Silicon, Raspberry Pi) and x86_64 (Intel/AMD) platforms.
105120

106121
##### Using Docker Compose (Recommended)
107122

@@ -363,6 +378,7 @@ docker compose -f docker-compose.dev.yml up -d
363378
- **Database**: SQLite (default) or PostgreSQL
364379
- **Caching/Queue**: Redis
365380
- **API Integration**: GitHub API (Octokit), Gitea API
381+
- **Native Packaging**: Tauri v2 (Windows, macOS, Linux)
366382
367383
## Contributing
368384
@@ -393,6 +409,7 @@ This project is now complete and ready for production use with version 1.0.0. Al
393409
- ✅ Multi-architecture support (ARM64 and x86_64)
394410
- ✅ Light/dark mode toggle
395411
- ✅ Persistent configuration storage
412+
- ✅ Native application packages for Windows, macOS, and Linux
396413
397414
## Troubleshooting
398415

docs/RELEASE.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Release Process for Gitea Mirror
2+
3+
This document explains how to create a new release of Gitea Mirror and how the automated build process works.
4+
5+
## Creating a New Release
6+
7+
1. Update the version number in:
8+
- `package.json`
9+
- `src-tauri/Cargo.toml`
10+
- `src-tauri/tauri.conf.json`
11+
12+
2. Create a new release on GitHub:
13+
- Go to the repository on GitHub
14+
- Click on "Releases" in the right sidebar
15+
- Click "Draft a new release"
16+
- Enter the tag version (e.g., `v1.0.1`)
17+
- Enter a release title (e.g., "Gitea Mirror v1.0.1")
18+
- Add release notes describing the changes
19+
- Click "Publish release"
20+
21+
3. The GitHub workflow will automatically:
22+
- Build packages for Windows, macOS, and Linux
23+
- Attach the packages to the release
24+
- Update the release description with installation instructions
25+
26+
## Automated Build Process
27+
28+
The automated build process is handled by the GitHub workflow defined in `.github/workflows/tauri-release.yml`. This workflow:
29+
30+
1. Triggers when a new release is created on GitHub
31+
2. Builds the application for multiple platforms:
32+
- Windows (`.exe` and `.msi`)
33+
- macOS (`.dmg`)
34+
- Linux (`.AppImage`, `.deb`, and `.rpm`)
35+
3. Uploads the built packages to the GitHub release
36+
4. Updates the release description with installation instructions
37+
38+
## Required GitHub Secrets
39+
40+
To enable the automated build process, you need to set up the following secrets in your GitHub repository:
41+
42+
1. `TAURI_PRIVATE_KEY`: The private key used to sign the application updates
43+
2. `TAURI_KEY_PASSWORD`: The password for the private key
44+
45+
### Generating a Signing Key
46+
47+
To generate a signing key for Tauri updates:
48+
49+
```bash
50+
pnpm tauri signer generate
51+
```
52+
53+
This will generate a private key and a public key. The keys are stored in:
54+
- `~/.tauri/[app-name].key` (private key)
55+
- `~/.tauri/[app-name].key.pub` (public key)
56+
57+
You can also specify a custom path:
58+
59+
```bash
60+
pnpm tauri signer generate -w /path/to/save/keys
61+
```
62+
63+
#### Adding the Keys to GitHub Secrets
64+
65+
1. Add the private key to GitHub secrets:
66+
```bash
67+
# Get the contents of the private key
68+
cat ~/.tauri/gitea-mirror.key
69+
```
70+
- Copy the output
71+
- Go to your GitHub repository
72+
- Click on "Settings" > "Secrets and variables" > "Actions"
73+
- Click "New repository secret"
74+
- Name: `TAURI_PRIVATE_KEY`
75+
- Value: Paste the contents of the private key
76+
77+
2. Add the password to GitHub secrets:
78+
- Go to your GitHub repository
79+
- Click on "Settings" > "Secrets and variables" > "Actions"
80+
- Click "New repository secret"
81+
- Name: `TAURI_KEY_PASSWORD`
82+
- Value: The password you used when generating the keys
83+
84+
#### Adding the Public Key to Your Tauri Configuration
85+
86+
1. Get the contents of the public key:
87+
```bash
88+
cat ~/.tauri/gitea-mirror.key.pub
89+
```
90+
91+
2. Update the `src-tauri/tauri.conf.json` file:
92+
```json
93+
"updater": {
94+
"active": true,
95+
"endpoints": [
96+
"https://github.com/arunavo4/gitea-mirror/releases/latest/download/update.json"
97+
],
98+
"dialog": true,
99+
"pubkey": "YOUR_PUBLIC_KEY_HERE"
100+
}
101+
```
102+
Replace `YOUR_PUBLIC_KEY_HERE` with the contents of your public key.
103+
104+
## Manual Building
105+
106+
If you need to build the packages manually:
107+
108+
### Prerequisites
109+
110+
- Node.js 22+
111+
- pnpm 8+
112+
- Rust (stable)
113+
- Platform-specific dependencies:
114+
- **Linux**: `libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev`
115+
- **macOS**: Xcode Command Line Tools
116+
- **Windows**: Microsoft Visual C++ Build Tools
117+
118+
### Building
119+
120+
```bash
121+
# Install dependencies
122+
pnpm install
123+
124+
# Build for all platforms
125+
pnpm tauri:build
126+
127+
# Build for specific platforms
128+
pnpm tauri:build:mac # macOS
129+
pnpm tauri:build:win # Windows
130+
pnpm tauri:build:linux # Linux
131+
```
132+
133+
The built packages will be available in:
134+
- `src-tauri/target/release/bundle/deb/` (Debian package)
135+
- `src-tauri/target/release/bundle/rpm/` (RPM package)
136+
- `src-tauri/target/release/bundle/appimage/` (AppImage)
137+
- `src-tauri/target/release/bundle/msi/` (Windows MSI)
138+
- `src-tauri/target/release/bundle/nsis/` (Windows EXE)
139+
- `src-tauri/target/release/bundle/dmg/` (macOS DMG)

0 commit comments

Comments
 (0)