Skip to content

Commit

Permalink
Release v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ZerNico committed Mar 5, 2023
1 parent adf0ac4 commit 40304ea
Show file tree
Hide file tree
Showing 28 changed files with 344 additions and 136 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
93 changes: 93 additions & 0 deletions .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Release Dockers

on:
push:
branches:
- main
release:
types: [published]

jobs:
api_to_registry:
name: Build and push API Docker image
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: zernico/sing-api
flavor: |
latest=auto
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=edge,branch=main
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./apps/api/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

web_to_registry:
name: Build and push web Docker image
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: zernico/sing-web
flavor: |
latest=auto
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=edge,branch=main
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./apps/web/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
42 changes: 42 additions & 0 deletions .github/workflows/release-electron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release Electron

on:
push:
branches:
- main
release:
types: [published]

jobs:
release-electron:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [windows-latest]

steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2

- uses: pnpm/action-setup@v2
with:
version: 7.25.0

- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Release electron app
run: pnpm run release --filter="electron..."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RENDERER_VITE_API_URL: ${{ vars.RENDERER_VITE_API_URL }}
RENDERER_VITE_WEB_URL: ${{ vars.RENDERER_VITE_WEB_URL }}
1 change: 1 addition & 0 deletions apps/api/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
30 changes: 30 additions & 0 deletions apps/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:18-alpine AS builder

RUN apk update && apk add --no-cache libc6-compat
RUN corepack enable && corepack prepare pnpm@7.4.1 --activate

WORKDIR /app

ENV PNPM_HOME="/root/.local/share/pnpm"
ENV PATH="${PATH}:${PNPM_HOME}"
RUN pnpm install -g turbo
COPY . .
RUN turbo prune --scope=api --docker

FROM node:18-alpine AS runner

RUN apk update && apk add --no-cache libc6-compat
RUN corepack enable && corepack prepare pnpm@7.4.1 --activate

WORKDIR /app

COPY --from=builder /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
COPY --from=builder /app/out/full/ ./
RUN pnpm install --frozen-lockfile
RUN pnpm run build --filter="api..."

EXPOSE 5000

WORKDIR /app/apps/api

CMD ["pnpm", "start:prod"]
7 changes: 4 additions & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api",
"version": "0.0.0",
"version": "0.0.1",
"main": "server.ts",
"scripts": {
"build": "tsc",
Expand All @@ -11,7 +11,8 @@
"db:push": "dotenv -e .env prisma db push",
"db:migrate:dev": "dotenv -e .env -- prisma migrate dev",
"db:migrate:deploy": "dotenv -e .env -- prisma migrate deploy",
"db:reset": "dotenv -e .env -- prisma migrate reset"
"db:reset": "dotenv -e .env -- prisma migrate reset",
"start:prod": "pnpm run db:migrate:deploy && pnpm run start"
},
"dependencies": {
"@fastify/cors": "^8.2.0",
Expand All @@ -33,7 +34,7 @@
"@types/node": "^18.11.18",
"eslint": "^8.32.0",
"eslint-config-custom": "workspace:*",
"prisma": "^4.9.0",
"prisma": "^4.11.0",
"ts-node-dev": "^2.0.0",
"tsconfig": "workspace:*"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ server.register(fastifyTRPCPlugin, {
trpcOptions: { router: appRouter, createContext },
})

server.listen({ port: env.PORT }, (err) => {
server.listen({ host: '0.0.0.0', port: env.PORT }, (err) => {
if (err) {
console.error(err)
process.exit(1)
Expand Down
1 change: 1 addition & 0 deletions apps/electron/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
dist
out
*.log*
electron.vite.config.*.mjs
18 changes: 9 additions & 9 deletions apps/electron/electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
appId: com.electron.app
productName: electron
appId: de.zernico.sing
productName: Tune Perfect
extraMetadata:
name: tuneperfect
directories:
buildResources: build
files:
Expand All @@ -10,9 +12,10 @@ files:
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
asarUnpack:
- resources/*
afterSign: build/notarize.js
win:
executableName: electron
executableName: tuneperfect
publish:
- github
nsis:
artifactName: ${name}-${version}-setup.${ext}
shortcutName: ${productName}
Expand All @@ -32,11 +35,8 @@ linux:
- AppImage
- snap
- deb
maintainer: electronjs.org
category: Utility
maintainer: ZerNico
category: Game
appImage:
artifactName: ${name}-${version}.${ext}
npmRebuild: false
publish:
provider: generic
url: https://example.com/auto-updates
58 changes: 0 additions & 58 deletions apps/electron/electron.vite.config.1674941033004.mjs

This file was deleted.

21 changes: 14 additions & 7 deletions apps/electron/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "electron",
"version": "0.0.0",
"description": "An Electron application with Vue and TypeScript",
"version": "0.0.1",
"description": "A karaoke game in Vue",
"main": "./out/main/index.js",
"homepage": "https://www.electronjs.org",
"repository": {
"type": "git",
"url": "https://github.com/ZerNico/sing.git"
},
"scripts": {
"format": "prettier --write .",
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix",
Expand All @@ -12,11 +15,13 @@
"typecheck": "npm run typecheck:node && npm run typecheck:web",
"start": "electron-vite preview",
"dev": "electron-vite dev --watch",
"build": "npm run typecheck && electron-vite build",
"prebuild": "npm run typecheck && electron-vite build",
"build": "npm run prebuild && electron-builder --config",
"postinstall": "electron-builder install-app-deps",
"build:win": "npm run build && electron-builder --win --config",
"build:mac": "npm run build && electron-builder --mac --config",
"build:linux": "npm run build && electron-builder --linux --config"
"build:win": "npm run prebuild && electron-builder --win --config",
"build:mac": "npm run prebuild && electron-builder --mac --config",
"build:linux": "npm run prebuild && electron-builder --linux --config",
"release": "npm run prebuild && electron-builder -p onTagOrDraft --config"
},
"dependencies": {
"@electron-toolkit/preload": "^1.0.3",
Expand All @@ -38,10 +43,12 @@
"@vueuse/core": "^9.11.1",
"@vueuse/integrations": "^9.11.1",
"@vueuse/sound": "^2.0.1",
"ajv": "^8.12.0",
"api": "workspace:*",
"dywapitchtrack": "^0.2.0",
"electron": "^21.3.3",
"electron-builder": "^23.6.0",
"electron-builder-notarize": "^1.5.1",
"electron-vite": "^1.0.17",
"eslint": "^8.31.0",
"eslint-config-custom": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion apps/electron/src/renderer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="UTF-8" />
<title>Electron</title>
<title>Tune Perfect</title>
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta
http-equiv="Content-Security-Policy"
Expand Down
5 changes: 0 additions & 5 deletions apps/electron/src/renderer/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ declare module '@vue/runtime-core' {
export interface GlobalComponents {
Avatar: typeof import('./components/Avatar.vue')['default']
Button: typeof import('./components/menu/Button.vue')['default']
copy: typeof import('./components/menu/RangeInput copy.vue')['default']
Half: typeof import('./components/game/Half.vue')['default']
Highscore: typeof import('./components/menu/songs/Highscore.vue')['default']
HUD: typeof import('./components/game/HUD.vue')['default']
Expand All @@ -28,14 +27,10 @@ declare module '@vue/runtime-core' {
RouterView: typeof import('vue-router')['RouterView']
ScoreCard: typeof import('./components/menu/sing/ScoreCard.vue')['default']
Search: typeof import('./components/menu/songs/Search.vue')['default']
Sing: typeof import('./components/sing.vue')['default']
SongCard: typeof import('./components/menu/songs/SongCard.vue')['default']
SongPlayer: typeof import('./components/SongPlayer.vue')['default']
Songs: typeof import('./components/menu/songs.vue')['default']
SongScroller: typeof import('./components/menu/songs/SongScroller.vue')['default']
SungPitchNote: typeof import('./components/game/SungPitchNote.vue')['default']
Test: typeof import('./components/menu/Test.vue')['default']
Tester: typeof import('./components/menu/Tester.vue')['default']
TitleBar: typeof import('./components/menu/TitleBar.vue')['default']
VirtualKeyboard: typeof import('./components/menu/songs/VirtualKeyboard.vue')['default']
WideButton: typeof import('./components/menu/WideButton.vue')['default']
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type InferArgs<T> = T extends (...t: [...infer Arg]) => any ? Arg : never
type InferReturn<T> = T extends (...t: [...infer Arg]) => infer Res ? Res : never
type InferReturn<T> = T extends () => infer Res ? Res : never

export default function useOfflineFallbackFn<TFunc extends (...args: any[]) => any>(fn: TFunc, fallbackFn: TFunc): (...args: InferArgs<TFunc>) => InferReturn<TFunc> {
const lobbyStore = useLobbyStore()
Expand Down
Loading

0 comments on commit 40304ea

Please sign in to comment.