Skip to content

Fixed check_time()

Fixed check_time() #71

Workflow file for this run

name: build
on: [push, pull_request, workflow_dispatch]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
PUBLIC_FACILITY_NAME: ${{ vars.PUBLIC_FACILITY_NAME }}
VATUSA_FACILITY_ID: ${{ vars.VATUSA_FACILITY_ID }}
PUBLIC_VATSIM_OAUTH_BASE: ${{ vars.PUBLIC_VATSIM_OAUTH_BASE }}
PUBLIC_VATSIM_OAUTH_CLIENT_ID: ${{ vars.PUBLIC_VATSIM_OAUTH_CLIENT_ID }}
PUBLIC_VATSIM_OAUTH_REDIRECT_URL: ${{ vars.PUBLIC_VATSIM_OAUTH_REDIRECT_URL }}
VATSIM_OAUTH_CLIENT_SECRET: ${{ secrets.VATSIM_OAUTH_CLIENT_SECRET }}
VATUSA_API_BASE: ${{ vars.VATUSA_API_BASE }}
VATUSA_API_KEY: ${{ secrets.VATUSA_API_KEY }}
MAX_BOOKING_AHEAD_DAYS: ${{ vars.MAX_BOOKING_AHEAD_DAYS }}
SMTP_HOST: ${{ secrets.SMTP_HOST }}
SMTP_PORT: ${{ secrets.SMTP_PORT }}
SMTP_SECURE: ${{ secrets.SMTP_SECURE }}
SMTP_AUTH_USER: ${{ secrets.SMTP_AUTH_USER }}
SMTP_AUTH_PASS: ${{ secrets.SMTP_AUTH_PASS }}
SMTP_EMAIL_FROM: ${{ secrets.SMTP_EMAIL_FROM }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
PUBLIC_SENTRY_DSN: ${{ secrets.PUBLIC_SENTRY_DSN }}
API_MASTER_KEY: ${{ secrets.API_MASTER_KEY }}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install build dependencies
run: bun install --frozen-lockfile
- name: Build production bundle
run: bun --bun run build
- name: Copy package manager tools
run: cp package.json build/ && cp bun.lockb build/
- name: Install production dependencies
run: cd build && bun i --frozen-lockfile --production
- name: Pack production bundle
run: cp -r build scheddy && tar -czvf scheddy.tar.gz scheddy
- name: Put server in maintenance mode
uses: garygrossgarten/github-action-ssh@release
with:
command: sudo touch /etc/caddy/maintenance.on
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
privateKey: ${{ secrets.SERVER_PRIVATE_KEY }}
- name: Stop main server
uses: garygrossgarten/github-action-ssh@release
with:
command: sudo systemctl stop scheddy
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
privateKey: ${{ secrets.SERVER_PRIVATE_KEY }}
- name: Upload bundle files to server
uses: burnett01/[email protected]
with:
switches: -avzP
path: scheddy
remote_path: ${{ secrets.SERVER_PATH }}
remote_host: ${{ secrets.SERVER_HOST }}
remote_user: ${{ secrets.SERVER_USERNAME }}
remote_key: ${{ secrets.SERVER_PRIVATE_KEY }}
- name: Run database migrations
run: bun drizzle-kit migrate
- name: Start main server
uses: garygrossgarten/github-action-ssh@release
with:
command: sudo systemctl start scheddy
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
privateKey: ${{ secrets.SERVER_PRIVATE_KEY }}
- name: Put server in production mode
uses: garygrossgarten/github-action-ssh@release
with:
command: sudo rm /etc/caddy/maintenance.on
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
privateKey: ${{ secrets.SERVER_PRIVATE_KEY }}