Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
nICEnnnnnnnLee committed Jan 8, 2023
1 parent c1c6805 commit 1378877
Show file tree
Hide file tree
Showing 71 changed files with 3,124 additions and 105 deletions.
66 changes: 66 additions & 0 deletions .github/scripts/update.mjs
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),
})
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
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 }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

tauri.key.pub
tauri.key
Binary file added favicon.ico
Binary file not shown.
23 changes: 23 additions & 0 deletions host.html
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>
Binary file added icons/128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Square107x107Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Square142x142Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Square150x150Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Square284x284Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Square30x30Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Square310x310Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Square44x44Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Square71x71Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/Square89x89Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon.icns
Binary file not shown.
Binary file added icons/icon.ico
Binary file not shown.
Binary file added icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 65 additions & 12 deletions index.html
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>
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"name": "master-lee",
"private": true,
"version": "0.0.0",
"version": "0.0.4",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"tauri": "tauri"
"tauri": "tauri",
"update": "node ./github/scripts/update.mjs"
},
"dependencies": {
"vue": "^3.2.45",
"@tauri-apps/api": "^1.2.0"
},
"devDependencies": {
"@actions/github": "^5.0.1",
"@vitejs/plugin-vue": "^4.0.0",
"vite": "^4.0.0",
"@tauri-apps/cli": "^1.2.2"
Expand Down
1 change: 0 additions & 1 deletion public/vite.svg

This file was deleted.

1 change: 1 addition & 0 deletions public/window-close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/window-maximize.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/window-minimize.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1378877

Please sign in to comment.