Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
kaumac committed Mar 22, 2024
0 parents commit c0db824
Show file tree
Hide file tree
Showing 296 changed files with 11,072 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NEXT_PUBLIC_API_URL=http://localhost:8787
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXT_PUBLIC_SUPABASE_ANON_KEY=
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPPORT_EMAIL=
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [timothymiller]
13 changes: 13 additions & 0 deletions .github/workflows/autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: autoupdate

on:
push: {}

jobs:
autoupdate:
name: autoupdate
runs-on: ubuntu-22.04
steps:
- uses: docker://chinthakagodawita/autoupdate-action:v1
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
53 changes: 53 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: 'Backend Deployment'

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'packages/api/**'

jobs:
deploy:
name: Deploy to Cloudflare Workers
runs-on: ubuntu-latest
timeout-minutes: 10
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: 'Bun setup'
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: 'Bun install'
run: bun install

- name: Migrate database
run: cd packages/api && bun run migrate
env:
NO_D1_WARNING: true
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}

- name: Deploy
uses: cloudflare/wrangler-action@v3.3.1
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
workingDirectory: packages/api
command: deploy src/index.ts
secrets: |
APP_URL
JWT_VERIFICATION_KEY
CI
env:
APP_URL: ${{ secrets.NEXT_PUBLIC_APP_URL }}
JWT_VERIFICATION_KEY: ${{ secrets.JWT_VERIFICATION_KEY }}
CI: true
NO_D1_WARNING: true
43 changes: 43 additions & 0 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish CLI to NPM

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'apps/cli/**'

jobs:
publish:
if: github.repository_owner == 'timothymiller'
name: Publish CLI to NPM
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

# - name: Check version changes
# uses: EndBug/version-check@v1
# id: check
# with:
# file-name: ./apps/cli/package.json

# - name: Version update detected
# if: steps.check.outputs.changed == 'true'
# run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"'

- name: Setup Node.js for NPM
# if: steps.check.outputs.changed == 'true'
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
scope: '@timothyjmiller' # Defaults to the user or organization that owns the workflow file

- name: Publish package to NPM
# if: steps.check.outputs.changed == 'true'
run: cd apps/cli && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: 'Docs Deployment'

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'apps/docs/**'

jobs:
publish:
name: Publish to Cloudflare Pages
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
deployments: write
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: 'Bun setup'
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: 'Bun install'
run: bun install

- name: Build
run: |
cd apps/docs
bunx @cloudflare/next-on-pages
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1.5.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
projectName: ${{ secrets.CF_PROJECT_NAME_DOCS }}
directory: .vercel/output/static
branch: main
wranglerVersion: '3'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
workingDirectory: apps/docs
74 changes: 74 additions & 0 deletions .github/workflows/expo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Expo Deployment

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'apps/expo/**'
- 'packages/ui/**'
- 'packages/app/**'

permissions:
contents: write

env:
# BUILD_PROFILE: development
BUILD_PROFILE: production

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: 'Bun setup'
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: 'Bun install'
run: bun install

- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Build app
id: build
continue-on-error: true
run: |
export TAMAGUI_TARGET=native
export EAS_OWNER=${{ secrets.EAS_OWNER }}
export EAS_PROJECT_ID=${{ secrets.EAS_PROJECT_ID }}
cd apps/expo && build_json=$(eas build --profile $BUILD_PROFILE --platform all --non-interactive --json)
android_link=$(echo $build_json | jq -r '.[] | select(.platform=="ANDROID") | .artifacts.applicationArchiveUrl')
ios_link=$(echo $build_json | jq -r '.[] | select(.platform=="IOS") | .artifacts.applicationArchiveUrl')
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "build_json<<$EOF" >> $GITHUB_OUTPUT
echo "$build_json" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
echo "android=$android_link" >> $GITHUB_OUTPUT
echo "ios=$ios_link" >> $GITHUB_OUTPUT
- name: Comment commit
if: github.event_name == 'push'
uses: peter-evans/commit-comment@v2
with:
body: |
✔ EAS ${{ env.BUILD_PROFILE }} build completed
- 🤖 Android ${{ steps.build.outputs.android != '' && '[build download][1]' || 'build failed ❌' }}
- 🍏 IOS ${{ steps.build.outputs.ios != '' && '[build download][2]' || 'build failed ❌' }}
${{ steps.build.outputs.android != '' && format('| [![Android QR](https://api.qrserver.com/v1/create-qr-code/?data={0}&bgcolor=CAFFE1&margin=10)](#void)', steps.build.outputs.android) || '| ❌' }} ${{ steps.build.outputs.ios != '' && format('| [![IOS QR](https://api.qrserver.com/v1/create-qr-code/?data={0}&bgcolor=CFE6FF&margin=10)](#void) |', steps.build.outputs.ios) || '| ❌ |' }}
| :------------: | :--------: |
| **Android QR** | **IOS QR** |
${{ steps.build.outputs.android != '' && format('[1]: {0}', steps.build.outputs.android) || '' }}
${{ steps.build.outputs.ios != '' && format('[2]: {0}', steps.build.outputs.ios) || '' }}
58 changes: 58 additions & 0 deletions .github/workflows/next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: 'Next.js Deployment'

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'apps/next/**'
- 'packages/ui/**'
- 'packages/app/**'

jobs:
publish:
name: Publish to Cloudflare Pages
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
deployments: write
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: 'Bun setup'
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: 'Bun install'
run: bun install

- name: Build
run: |
cd apps/next
export TAMAGUI_TARGET=web
export NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }}
export NEXT_PUBLIC_APP_URL=${{ secrets.NEXT_PUBLIC_APP_URL }}
export NEXT_PUBLIC_SUPABASE_URL=${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
export NEXT_PUBLIC_SUPABASE_ANON_KEY=${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
bunx @cloudflare/next-on-pages
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1.5.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
projectName: ${{ secrets.CF_PROJECT_NAME }}
directory: .vercel/output/static
branch: main
wranglerVersion: '3'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
workingDirectory: apps/next
82 changes: 82 additions & 0 deletions .github/workflows/tauri.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: 'Tauri build'
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'packages/tauri/**'
- 'packages/ui/**'
- 'packages/app/**'

env:
NEXT_PUBLIC_SUPABASE_URL: ${{secrets.NEXT_PUBLIC_SUPABASE_URL}}

jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
# macos-latest, ubuntu-20.04, windows-latest
platform: [windows-latest]
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Cargo cache rotation keys
id: rust-cache-rotation
shell: bash
run: |
echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT
- name: Cargo Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./apps/tauri/src-tauri/target
key: ${{ runner.os }}-cargo-${{ steps.rust-cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ steps.rust-cache-rotation.outputs.YEAR_MONTH }}-
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Bun setup
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Bun install
run: bun install

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: app-v__VERSION__
releaseName: 'App v__VERSION__'
releaseBody: 'See the assets to download this version and install it.'
releaseDraft: true
prerelease: false
projectPath: ./apps/tauri/
distPath: ./apps/tauri/out/
tauriScript: bun
# You can change the following flags to include release and/or debug builds
includeDebug: true
includeRelease: false
Loading

1 comment on commit c0db824

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔ EAS production build completed

  • 🤖 Android build failed ❌
  • 🍏 IOS build failed ❌
Android QR IOS QR

Please sign in to comment.