-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1c6805
commit 1378877
Showing
71 changed files
with
3,124 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import fetch from 'node-fetch' | ||
import { getOctokit, context } from '@actions/github' | ||
|
||
const UPDATE_TAG_NAME = 'updater' | ||
const UPDATE_FILE_NAME = 'update.json' | ||
|
||
const getSignature = async (url) => { | ||
const response = await fetch(url, { method: 'GET', headers: { 'Content-Type': 'application/octet-stream' } }) | ||
return response.text() | ||
} | ||
|
||
const updateData = { | ||
name: '', | ||
pub_date: new Date().toISOString(), | ||
platforms: { | ||
win64: { signature: '', url: '' }, | ||
linux: { signature: '', url: '' }, | ||
darwin: { signature: '', url: '' }, | ||
'linux-x86_64': { signature: '', url: '' }, | ||
'windows-x86_64': { signature: '', url: '' }, | ||
}, | ||
} | ||
|
||
const octokit = getOctokit(process.env.GITHUB_TOKEN) | ||
const options = { owner: context.repo.owner, repo: context.repo.repo } | ||
|
||
const { data: release } = await octokit.rest.repos.getLatestRelease(options) | ||
updateData.name = release.tag_name | ||
for (const { name, browser_download_url } of release.assets) { | ||
if (name.endsWith('.msi.zip')) { | ||
updateData.platforms.win64.url = browser_download_url | ||
updateData.platforms['windows-x86_64'].url = browser_download_url | ||
} else if (name.endsWith('.msi.zip.sig')) { | ||
const signature = await getSignature(browser_download_url) | ||
updateData.platforms.win64.signature = signature | ||
updateData.platforms['windows-x86_64'].signature = signature | ||
} else if (name.endsWith('.app.tar.gz')) { | ||
updateData.platforms.darwin.url = browser_download_url | ||
} else if (name.endsWith('.app.tar.gz.sig')) { | ||
const signature = await getSignature(browser_download_url) | ||
updateData.platforms.darwin.signature = signature | ||
} else if (name.endsWith('.AppImage.tar.gz')) { | ||
updateData.platforms.linux.url = browser_download_url | ||
updateData.platforms['linux-x86_64'].url = browser_download_url | ||
} else if (name.endsWith('.AppImage.tar.gz.sig')) { | ||
const signature = await getSignature(browser_download_url) | ||
updateData.platforms.linux.signature = signature | ||
updateData.platforms['linux-x86_64'].signature = signature | ||
} | ||
} | ||
|
||
const { data: updater } = await octokit.rest.repos.getReleaseByTag({ ...options, tag: UPDATE_TAG_NAME }) | ||
|
||
for (const { id, name } of updater.assets) { | ||
if (name === UPDATE_FILE_NAME) { | ||
await octokit.rest.repos.deleteReleaseAsset({ ...options, asset_id: id }) | ||
break | ||
} | ||
} | ||
|
||
await octokit.rest.repos.uploadReleaseAsset({ | ||
...options, | ||
release_id: updater.id, | ||
name: UPDATE_FILE_NAME, | ||
data: JSON.stringify(updateData), | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- "package.json" | ||
workflow_dispatch: | ||
inputs: | ||
|
||
jobs: | ||
release: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [macos-latest, ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
- name: Install Dependencies (ubuntu only) | ||
if: matrix.platform == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf | ||
- run: yarn | ||
|
||
- name: Build Tauri | ||
uses: tauri-apps/tauri-action@v0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | ||
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_KEY_PASSWORD }} | ||
with: | ||
tagName: v__VERSION__ | ||
releaseName: v__VERSION__ | ||
update: | ||
needs: release | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
|
||
- run: yarn | ||
|
||
- name: Create Update | ||
run: yarn update | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,6 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
tauri.key.pub | ||
tauri.key |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/tauri.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Master Lee</title> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<!-- <script type="module" src="/src/main.js"> --> | ||
<script type="module"> | ||
import { createApp } from "vue"; | ||
import "./src/style.css"; | ||
import App from "./src/App.vue"; | ||
|
||
createApp(App).mount("#app"); | ||
</script> | ||
</body> | ||
|
||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,67 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Tauri + Vue 3 App</title> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.js"></script> | ||
</body> | ||
</html> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/tauri.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Master Lee</title> | ||
<style> | ||
.titlebar { | ||
height: 30px; | ||
background: #e6ecec; | ||
user-select: none; | ||
display: flex; | ||
justify-content: flex-end; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
} | ||
|
||
.titlebar-button { | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 30px; | ||
height: 30px; | ||
} | ||
|
||
.titlebar-button:hover { | ||
background: #5bbec3; | ||
} | ||
</style> | ||
</head> | ||
<div data-tauri-drag-region class="titlebar"> | ||
<div class="titlebar-button" id="titlebar-minimize"> | ||
<img src="/window-minimize.svg" alt="minimize" /> | ||
</div> | ||
<!-- <div class="titlebar-button" id="titlebar-maximize"> | ||
<img src="/window-maximize.svg" alt="maximize" /> | ||
</div> --> | ||
<div class="titlebar-button" id="titlebar-close"> | ||
<img src="/window-close.svg" alt="close" /> | ||
</div> | ||
</div> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module"> | ||
import { createApp } from "vue"; | ||
import "./src/style.css"; | ||
import App from "./src/App.vue"; | ||
import { appWindow } from '@tauri-apps/api/window' | ||
document | ||
.getElementById('titlebar-minimize') | ||
.addEventListener('click', () => appWindow.minimize()) | ||
// document | ||
// .getElementById('titlebar-maximize') | ||
// .addEventListener('click', () => appWindow.toggleMaximize()) | ||
document | ||
.getElementById('titlebar-close') | ||
.addEventListener('click', () => appWindow.close()) | ||
createApp(App).mount("#app"); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.