Skip to content

Commit

Permalink
ci: Package server for release (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrink authored Nov 30, 2024
1 parent fe70461 commit 953b334
Show file tree
Hide file tree
Showing 9 changed files with 1,123 additions and 26 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release (package, build, publish)

on:
push:
tags:
- "v*"

permissions:
contents: write
id-token: write

jobs:
upload-build-to-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- run: npm ci
- name: Build and package server
run: npm run package -- --targets node18-alpine-x64,node18-linux-x64,node18-macos-x64,node18-win-x64
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
file: "./builds/handles-server*"
file_glob: true
overwrite: true
make_latest: false
publish-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- run: npm ci
- run: npm run build
- uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NODE_AUTH_TOKEN }}
access: public
provenance: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/node_modules
/dist
.vercel
/bin
/handles-server
/builds
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/package-lock.json
/dist
/.vercel
/bin
/builds
4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"plugins": ["prettier-plugin-packagejson"]
}
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ A very simple server that reponds to Bluesky handle verification requests for
the domain(s) that the server is exposed to, as an alternative to managing
claims via DNS. Configure with a provider, and let it run.

> [!IMPORTANT]
> `handles-server` is already serving thousands of Handles in production
> at [Handles Club](https://handles.club) and [handles.net](https://handles.net)
> but as it is not yet v1 it may change.
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fshrink-inc%2Fhandles-server&env=HANDLES_PROVIDER)

```shell
$ curl -O https://github.com/prompt/handles-server/releases/download/v0/handles-server-linux
$ HANDLES_PROVIDER="map:alice.at.example.com->did:plc:example1" ./handles-server-linux
```

## Providers

The provider is configured using the `HANDLES_PROVIDER` Environment Variable. A
Expand All @@ -23,7 +33,7 @@ values it has been configured with.

```shell
$ HANDLES_PROVIDER="map:alice.at.example.com->did:plc:example1,bob.at.example.com->did:plc:example2" \
npm run dev
./handles-server

[00:00:00.000] INFO (0000): Resolved configuration to provider 'map'
[00:00:00.000] DEBUG (0000): Successfully parsed a list of handles.
Expand Down Expand Up @@ -56,7 +66,7 @@ Environment Variable which contains the connection string or it can contain a
connection string itself.

```shell
$ HANDLES_PROVIDER="pg:DATABASE_URL" npm run dev
$ HANDLES_PROVIDER="pg:DATABASE_URL" ./handles-server
```

### Google Sheets
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import eslint from "@eslint/js";
import tseslint from "typescript-eslint";

export default tseslint.config(
{ ignores: ["dist/*", ".vercel/*"] },
{ ignores: ["dist/*", ".vercel/*", "bin/*", "builds/*"] },
eslint.configs.recommended,
...tseslint.configs.recommended,
);
8 changes: 4 additions & 4 deletions logging.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pino, { Logger } from "pino";

export const logger: Logger = ["production", "test"].includes(
process.env["NODE_ENV"] || "unknown",
)
? pino({ level: "warn" })
const environment = process.env["NODE_ENV"] || "production";

export const logger: Logger = ["production", "test"].includes(environment)
? pino({ level: "info" })
: pino({
transport: {
target: "pino-pretty",
Expand Down
Loading

0 comments on commit 953b334

Please sign in to comment.