Skip to content

Commit 3a36fbe

Browse files
committedFeb 1, 2025
feat: set version to github.sha
1 parent 08c8be7 commit 3a36fbe

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed
 

‎.github/workflows/deploy-preview.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jobs:
5151

5252
- name: deploy
5353
if: ${{ github.event.inputs.dry-run != 'true' }}
54+
env:
55+
API_VERSION: ${{ github.sha }}
5456
uses: cloudflare/wrangler-action@6d58852c35a27e6034745c5d0bc373d739014f7f # v3.13.0
5557
with:
5658
apiToken: ${{ secrets.CF_API_TOKEN }}

‎.github/workflows/deploy.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050

5151
- name: deploy
5252
if: ${{ github.event.inputs.dry-run != 'true' }}
53+
env:
54+
API_VERSION: ${{ github.sha }}
5355
uses: cloudflare/wrangler-action@6d58852c35a27e6034745c5d0bc373d739014f7f # v3.13.0
5456
with:
5557
apiToken: ${{ secrets.CF_API_TOKEN }}

‎src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { ApiError } from "./schemas";
22
import type { HonoContext } from "./types";
33
import { OpenAPIHono } from "@hono/zod-openapi";
44
import { apiReference } from "@scalar/hono-api-reference";
5+
import { env } from "hono/adapter";
56
import { HTTPException } from "hono/http-exception";
67

78
const app = new OpenAPIHono<HonoContext>();
@@ -80,7 +81,7 @@ app.doc("/openapi.json", (c) => {
8081
return {
8182
openapi: "3.0.0",
8283
info: {
83-
version: "1.0.0",
84+
version: env(c).API_VERSION || "x.y.z",
8485
title: "Mojis API",
8586
},
8687
tags: [

‎src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export interface HonoContext {
22
Bindings: {
33
ENVIRONMENT: string;
4+
API_VERSION?: string;
45
};
56
}
67

0 commit comments

Comments
 (0)