pipeline and config
This commit is contained in:
parent
c4d9ca19ce
commit
8dcc6b05db
3 changed files with 43 additions and 9 deletions
32
.forgejo/wokflows/pipeline.yaml
Normal file
32
.forgejo/wokflows/pipeline.yaml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
on:
|
||||
release:
|
||||
types: [published]
|
||||
jobs:
|
||||
upload:
|
||||
runs-on: host
|
||||
permissions:
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24
|
||||
- uses: actions/checkout@v6
|
||||
- run: |
|
||||
npm install
|
||||
npm run build
|
||||
- run: ~/.cargo/bin/cargo build -r
|
||||
- run: |
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${{ github.token }}" \
|
||||
-F "attachment=@target/release/bot" \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets"
|
||||
- run: |
|
||||
export XDG_RUNTIME_DIR=/run/user/$(id -u)
|
||||
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
|
||||
systemctl --user stop bot
|
||||
cp target/release/bot ~/bot/bot
|
||||
chmod +x ~/bot/bot
|
||||
mkdir -p ~/bot/fe
|
||||
rm -rf ~/bot/fe/*
|
||||
cp -r dist/* ~/bot/fe/
|
||||
systemctl --user start bot
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { marked } from 'marked';
|
||||
import DOMPurify from 'dompurify';
|
||||
|
||||
const API_URL = 'http://localhost:3000';
|
||||
const API_URL = 'http://localhost:3000/api';
|
||||
// These should ideally be environment-specific
|
||||
const AUTH_CONFIG = {
|
||||
issuer: 'https://idm.flegr.me/application/o/bot/',
|
||||
|
|
|
|||
|
|
@ -122,17 +122,19 @@ pub async fn start(db_url: &str) -> Result<(), Box<dyn std::error::Error>> {
|
|||
.allow_headers(Any);
|
||||
|
||||
let app = Router::new()
|
||||
.route("/tasks", post(create_task).get(list_tasks))
|
||||
.route("/tasks/:id", get(get_task).put(update_task))
|
||||
.route("/tasks/:id/runs", post(rerun_task))
|
||||
.route("/runs/recent", get(get_recent_runs))
|
||||
.route("/auth/callback", get(auth_callback))
|
||||
.route("/auth/refresh", post(auth_refresh))
|
||||
.route("/api/tasks", post(create_task).get(list_tasks))
|
||||
.route("/api/tasks/:id", get(get_task).put(update_task))
|
||||
.route("/api/tasks/:id/runs", post(rerun_task))
|
||||
.route("/api/runs/recent", get(get_recent_runs))
|
||||
.route("/api/auth/callback", get(auth_callback))
|
||||
.route("/api/auth/refresh", post(auth_refresh))
|
||||
.layer(cors)
|
||||
.with_state(state);
|
||||
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
|
||||
println!("Server running on http://localhost:3000");
|
||||
let port = std::env::var("PORT").unwrap_or_else(|_| "3000".to_string());
|
||||
let addr = format!("0.0.0.0:{}", port);
|
||||
let listener = tokio::net::TcpListener::bind(&addr).await?;
|
||||
println!("Server running on http://localhost:{}", port);
|
||||
axum::serve(listener, app).await?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue