Skip to content

Commit

Permalink
Update Deno + dependencies.
Browse files Browse the repository at this point in the history
Also add docker image build.
  • Loading branch information
BrunoBernardino committed Jun 11, 2024
1 parent 24e7fa9 commit 1ffe19b
Show file tree
Hide file tree
Showing 18 changed files with 77 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .dvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.41.0
1.44.1
4 changes: 2 additions & 2 deletions .github/workflows/cron-check-subscriptions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
cron-cleanup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.41.0
deno-version: v1.44.1
- env:
POSTGRESQL_HOST: ${{ secrets.POSTGRESQL_HOST }}
POSTGRESQL_USER: ${{ secrets.POSTGRESQL_USER }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cron-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
cron-cleanup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.41.0
deno-version: v1.44.1
- env:
POSTGRESQL_HOST: ${{ secrets.POSTGRESQL_HOST }}
POSTGRESQL_USER: ${{ secrets.POSTGRESQL_USER }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "Docker Image"

on:
workflow_dispatch:
schedule:
# At 06:01 on the 5th of every month.
- cron: "1 6 5 * *"
push:
branches:
- "main"
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
with:
deno-version: v1.41.0
deno-version: v1.44.1
- run: docker-compose pull
- uses: jpribyl/[email protected]
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM denoland/deno:1.41.0
FROM denoland/deno:1.44.1

EXPOSE 8000

Expand Down
6 changes: 5 additions & 1 deletion import_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"/": "./",
"./": "./",

"std/": "https://deno.land/[email protected]/"
"std/assert/assert-equals": "jsr:@std/[email protected]/assert-equals",
"std/assert/assert-not-equals": "jsr:@std/[email protected]/assert-not-equals",
"std/http/file-server": "jsr:@std/[email protected]/file-server",
"std/dotenv/load": "jsr:@std/[email protected]/load",
"deno/emit": "jsr:@deno/[email protected]"
}
}
4 changes: 2 additions & 2 deletions lib/interfaces/database.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Client } from 'https://deno.land/x/[email protected]/mod.ts';
import 'std/dotenv/load.ts';
import 'std/dotenv/load';
import { Client } from 'https://deno.land/x/[email protected]/mod.ts';

const POSTGRESQL_HOST = Deno.env.get('POSTGRESQL_HOST') || '';
const POSTGRESQL_USER = Deno.env.get('POSTGRESQL_USER') || '';
Expand Down
2 changes: 1 addition & 1 deletion lib/providers/brevo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'std/dotenv/load.ts';
import 'std/dotenv/load';

import { helpEmail, IS_UNSAFE_SELF_HOSTED } from '/lib/utils.ts';

Expand Down
2 changes: 1 addition & 1 deletion lib/providers/stripe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'std/dotenv/load.ts';
import 'std/dotenv/load';

import { baseUrl, jsonToFormUrlEncoded } from '/lib/utils.ts';

Expand Down
6 changes: 3 additions & 3 deletions lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'std/dotenv/load.ts';
import { transpile } from 'https://deno.land/x/[email protected]/mod.ts';
import 'std/dotenv/load';
import { serveFile } from 'std/http/file-server';
import { transpile } from 'deno/emit';
import sass from 'https://deno.land/x/[email protected]/mod.ts';
import { serveFile } from 'std/http/file_server.ts';

import header from '/components/header.ts';
import footer from '/components/footer.ts';
Expand Down
2 changes: 1 addition & 1 deletion lib/utils_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from 'std/assert/assert_equals.ts';
import { assertEquals } from 'std/assert/assert-equals';
import { escapeHtml, generateRandomCode, jsonToFormUrlEncoded, splitArrayInChunks } from './utils.ts';

Deno.test('that escapeHtml works', () => {
Expand Down
2 changes: 1 addition & 1 deletion main_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from 'std/assert/assert_equals.ts';
import { assertEquals } from 'std/assert/assert-equals';
import { abortController } from './main.ts';

const baseUrl = 'http://localhost:8000';
Expand Down
2 changes: 1 addition & 1 deletion migrate-db.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'std/dotenv/load.ts';
import 'std/dotenv/load';

import Database, { sql } from '/lib/interfaces/database.ts';

Expand Down
3 changes: 2 additions & 1 deletion public/ts/encryption_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { assertEquals, assertNotEquals } from 'std/testing/asserts.ts';
import { assertEquals } from 'std/assert/assert-equals';
import { assertNotEquals } from 'std/assert/assert-not-equals';
import { KeyPair } from '/lib/types.ts';
import Encryption from './encryption.ts';

Expand Down
2 changes: 1 addition & 1 deletion public/ts/utils_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from 'std/assert/assert_equals.ts';
import { assertEquals } from 'std/assert/assert-equals';
import { dateDiffInDays, formatNumber, SupportedCurrencySymbol, validateEmail } from './utils.ts';

Deno.test('that dateDiffInDays works', () => {
Expand Down
2 changes: 1 addition & 1 deletion routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { serveFile } from 'std/http/file_server.ts';
import { serveFile } from 'std/http/file-server';
import { baseUrl, basicLayoutResponse, PageContentResult, serveFileWithSass, serveFileWithTs } from './lib/utils.ts';

// NOTE: This won't be necessary once https://github.com/denoland/deploy_feedback/issues/433 is closed
Expand Down

0 comments on commit 1ffe19b

Please sign in to comment.