Skip to content

Commit

Permalink
Merge pull request #2 from Ancientkingg/main
Browse files Browse the repository at this point in the history
Push changes to deployment environment ⚡
  • Loading branch information
Ancientkingg authored May 12, 2024
2 parents c4da5a7 + 27e1a0b commit 1192a2f
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 52 deletions.
1 change: 0 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

env:
CARGO_TERM_COLOR: always
# DATABASE_URL: ${{ vars.DATABASE_URL }}

jobs:
build:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/shuttle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Shuttle Deploy

on:
push:
branches: [ "prod" ]
pull_request:
branches: [ "prod" ]

jobs:
deploy:
runs-on: ubuntu-latest
environment: shuttle
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: client/package-lock.json

- name: Build front-end
run: |
npm ci
npm run deploy
working-directory: client

- uses: shuttle-hq/deploy-action@main
with:
deploy-key: ${{ secrets.SHUTTLE_API_KEY }}
working-directory: "backend"
name: "my-project"
allow-dirty: "true"
no-test: "true"
cargo-shuttle-version: "0.28.1"
secrets: |
DB_PASSWORD = '${{ secrets.LOCAL_DB_PASSWORD }}'
COOKIE_KEY = '${{ secrets.COOKIE_KEY }}'
26 changes: 26 additions & 0 deletions .github/workflows/ts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: TS CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: client/package-lock.json

- name: Build front-end
run: |
npm ci
npm run build
working-directory: client
47 changes: 0 additions & 47 deletions client/README.md

This file was deleted.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"deploy": "vite build --emptyOutDir --outDir ../server/public",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json"
Expand Down
5 changes: 4 additions & 1 deletion server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ target
target/*

.env
Secrets.toml
Secrets.toml

public
public/*
34 changes: 34 additions & 0 deletions server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ shuttle-shared-db = { version = "0.44.0", features = ["postgres", "sqlx"] }
sqlx = { version = "0.7.4", features = ["runtime-tokio", "postgres", "chrono", "macros", "tls-rustls"] }
tokio = { version = "1.37.0", features = ["full"] }
tower = "0.4.13"
tower-http = { version = "0.5.2", features = ["cors"] }
tower-http = { version = "0.5.2", features = ["fs", "cors"] }
6 changes: 5 additions & 1 deletion server/Shuttle.toml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
name = "tijdcapsule"
name = "tijdcapsule"

assets = [
"public/*"
]
4 changes: 3 additions & 1 deletion server/src/routers/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use axum::{http::Method, routing::{ get, post }, Router};
use tower_http::cors::{Any, CorsLayer};
use crate::utils::state::AppState;
use tower_http::services::ServeDir;

use super::root;
use super::capsule;
Expand All @@ -16,7 +17,8 @@ pub fn new_with_state(state: AppState) -> Router {
// let middleware = map_request_with_state(state.clone(), client_id::set_and_verify);

Router::new()
.route("/", get(root::handler::get))
.nest_service("/", ServeDir::new("public"))
.route("/health", get(root::handler::get))
.route("/capsule", post(capsule::handler::post))
.route("/capsule/:capsule_id", get(capsule::handler::get))
.layer(cors)
Expand Down

0 comments on commit 1192a2f

Please sign in to comment.