Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d46b3bc
fix entrypoint shabang
cbackas Oct 27, 2024
16bb272
initial stuff use deno formatting, linting, and fix file imports
cbackas Oct 27, 2024
83b1986
fix process.env related errors
cbackas Oct 27, 2024
b0376c9
replace dotenv with deno std lib
cbackas Oct 27, 2024
7650aac
remove "ignored" fields from deno.json
cbackas Oct 27, 2024
42040bb
fix build errors and move more config from package to deno
cbackas Oct 27, 2024
b88865c
fix all the deno lint errors
cbackas Oct 27, 2024
0411203
get rid of the rest of the node-schedule usage in favor of deno cron
cbackas Oct 28, 2024
7a90a07
fix issues after changing out airdate to timeswtamp
cbackas Oct 28, 2024
de617f6
further delete esbuild and replace scripts with deno things
cbackas Oct 28, 2024
8f6c957
finish up deno scripts
cbackas Oct 28, 2024
14ff6b9
update all the stuff to make it run in docker
cbackas Oct 28, 2024
e4e58a8
even more deno conf tweaks
cbackas Oct 28, 2024
e17ddcc
update workflows and get rid of package.json entirely
cbackas Oct 28, 2024
12f577d
fix filters on test-release workflow
cbackas Oct 28, 2024
6200f84
fix import map
cbackas Oct 28, 2024
38ebc06
rework the github actions
cbackas Nov 16, 2024
e3e6dac
remove semantic release stuff from deno import map
cbackas Nov 16, 2024
1e6be12
fix json
cbackas Nov 16, 2024
4ca4a72
add docker caching
cbackas Nov 16, 2024
ca4016b
further touch up the docker image workflows
cbackas Nov 16, 2024
9eeed6c
fix up deno settings for prisma client to work
cbackas Nov 16, 2024
06b33b4
add some --allow-scripts to the Dockerfile
cbackas Nov 16, 2024
42f12de
add more --allow-scripts
cbackas Nov 16, 2024
326e357
dont automatically semantic-release anymore
cbackas Nov 16, 2024
e4e1f10
missing comma in deno.json
cbackas Nov 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ README.md
data/
mongodata
fly.toml
.git
node_modules/
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

17 changes: 0 additions & 17 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Fly Deploy
on:
workflow_dispatch:
workflow_call:
jobs:
deploy:
name: Deploy app
Expand Down
51 changes: 16 additions & 35 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,29 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
# pull the repo
- uses: actions/checkout@v4
# setup node
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# install dependencies
- name: Install Node.js dependencies
run: npm ci
# run eslint
- name: Run linters
uses: wearerequired/lint-action@master
with:
auto_fix: false
eslint: true
eslint_fix: false
eslint_extensions: "js,ts"
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# setup node
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# install dependencies
- name: Install Node.js dependencies
run: npm ci
# build the app
- name: Build TVBot
run: npm run build
- uses: denoland/setup-deno@v2
- run: deno lint
test-semantic-release:
uses: ./.github/workflows/semantic-release.yml
with:
dry_run: true
build_docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.github_token }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Build and push
- name: build and push
uses: docker/build-push-action@v6
with:
tags: ghcr.io/cbackas/tvbot:pr-${{github.event.pull_request.number}}
platforms: linux/amd64,linux/arm64
push: false # just check that it builds, dont push it anywhere cuz whatever
tags: cbackas/tvbot:pr
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
51 changes: 0 additions & 51 deletions .github/workflows/push.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Semantic Release
on:
workflow_dispatch:
workflow_call:
inputs:
dry_run:
required: false
type: boolean
default: false
jobs:
release:
name: Semantic Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
- name: Install Semantic Release
run: npm install semantic-release conventional-changelog-eslint
- name: Dry Run Semantic Release
if: ${{ inputs.dry_run == true }}
run: npx semantic-release --dry-run
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Semantic Release
if: ${{ inputs.dry_run == false }}
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Tags
on:
workflow_dispatch:
push:
tags:
- '*.*.*'
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/metadata-action@v5
id: meta
with:
images: |
ghcr.io/cbackas/tvbot
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.github_token }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: build and push
uses: docker/build-push-action@v6
with:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
push: true

deploy:
needs: build_and_push
uses: ./.github/workflows/fly-deploy.yml
22 changes: 9 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
FROM node:20-slim as build
WORKDIR /build
COPY . .
RUN npm ci
RUN npm run build

FROM node:20-slim as prod
FROM denoland/deno:debian
WORKDIR /app
RUN apt-get update && apt-get -y install openssl
RUN npm install pm2 prisma --save-dev && npm install @prisma/client
COPY --from=build /build/prisma ./prisma
COPY --from=build /build/dist .
COPY --from=build /build/entrypoint.sh .
RUN apt-get update && \
apt-get install -y --no-install-recommends \
openssl \
&& \
rm -rf /var/lib/apt/lists/*
COPY . .
RUN deno install -r --allow-scripts=npm:@prisma/client,npm:prisma,npm:@prisma/engines
RUN deno run -A --unstable npm:prisma generate --no-engine
ENV TZ="America/Chicago"
RUN npx prisma generate
ENTRYPOINT ["sh", "entrypoint.sh"]
29 changes: 29 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"tasks": {
"dev": "deno --watch --no-clear-screen -A --unstable-cron --allow-scripts=npm:prisma,npm:@prisma/client,npm:@prisma/engines ./src/app.ts",
"build": "deno compile --unstable-cron -o ./dist/tvbot ./src/app.ts",
"db:migrate": "deno run -A npm:prisma migrate dev",
"db:studio": "deno run -A npm:prisma studio"
},
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
},
"nodeModules": true,
"nodeModulesDir": "auto",
"importMap": "import_map.json",
"lint": {
"include": ["src/"],
"exclude": ["src/testdata/", "src/fixtures/**/*.ts"],
"rules": {
"tags": ["recommended"],
"include": ["ban-untagged-todo"],
"exclude": ["no-unused-vars"]
},
},
"fmt": {
"semiColons": false
},
"exclude": ["dist/"]
}
Loading