Skip to content

Commit

Permalink
Add github action init
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Dec 23, 2024
1 parent 40dd28d commit 7f855dc
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 20 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/translate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
jobs:
translate:
name: Run translation
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Languine
uses: midday-ai/languine@main
env:
GH_TOKEN: ${{ github.token }}
with:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
10 changes: 5 additions & 5 deletions apps/web/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
export default function Page() {
return (
<Tabs
defaultValue="how-it-works"
defaultValue="get-started"
className="h-screen w-screen overflow-hidden"
>
<div className="flex justify-between bg-[#1B1B1B]">
<TabsList className="w-full flex justify-start rounded-none bg-[#1B1B1B]">
<TabsTrigger value="how-it-works">How it works</TabsTrigger>
<TabsTrigger value="install">Install</TabsTrigger>
<TabsTrigger value="get-started">Get started</TabsTrigger>
<TabsTrigger value="documentation">Documentation</TabsTrigger>
<TabsTrigger value="about">About</TabsTrigger>
<a href="https://github.com/midday-ai/languine">
<button
Expand All @@ -37,14 +37,14 @@ export default function Page() {
</div>

<div className="p-6 mt-4 h-full overflow-y-auto pb-[100px]">
<TabsContent value="how-it-works">
<TabsContent value="get-started">
<Logo />
<div className="text-sm font-mono">
<p>Translate your application with Languine CLI powered by AI.</p>
<Commands />
</div>
</TabsContent>
<TabsContent value="install">
<TabsContent value="documentation">
<Install />
</TabsContent>
<TabsContent value="about">
Expand Down
73 changes: 58 additions & 15 deletions apps/web/src/components/install.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,65 @@ export function Install() {
};

return (
<div className="text-sm font-mono">
<p>Install Languine CLI</p>
<div className="font-mono space-y-8">
<h2 className="text-lg font-medium">Getting started</h2>
<div className="text-sm font-mono">
<p>Install Languine CLI</p>

<div className="flex items-center mt-4 space-x-2">
<span className="text-primary">$ npx languine@latest</span>
<button
type="button"
onClick={copyCommand}
className="active:scale-90 transition-transform"
>
{copied ? (
<Check className="size-4 transition-colors" />
) : (
<Copy className="size-4 hover:text-primary transition-colors" />
)}
</button>
<div className="flex items-center mt-4 space-x-2">
<span className="text-primary">$ npx languine@latest</span>
<button
type="button"
onClick={copyCommand}
className="active:scale-90 transition-transform"
>
{copied ? (
<Check className="size-4 transition-colors" />
) : (
<Copy className="size-4 hover:text-primary transition-colors" />
)}
</button>
</div>
</div>

<div>
<h2 className="text-lg font-medium">CLI</h2>
<pre className="text-xs font-mono mt-4">
<code>{`init Initialize a new Languine configuration
translate Translate to all target locales
translate <locale> Translate to a specific locale
instructions Add custom translation instructions
diff Check for changes in source locale file
clean Clean unused translations
available Show available commands
Run languine <command> to execute a command`}</code>
</pre>
</div>

<div>
<h2 className="text-lg font-medium">
Github Actions{" "}
<span className="text-xs text-muted-foreground">(Coming soon)</span>
</h2>
<pre className="text-xs font-mono mt-4">
<code>{`jobs:
translate:
name: Run translation
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Languine
uses: midday-ai/languine@main
env:
GH_TOKEN: \${{ github.token }}
with:
OPENAI_API_KEY: \${{ secrets.OPENAI_API_KEY }}
`}</code>
</pre>
</div>
</div>
);
Expand Down
11 changes: 11 additions & 0 deletions packages/action/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM oven/bun:1

WORKDIR /app

COPY package*.json tsconfig.json /app/

COPY src /app/src

RUN bun install

ENTRYPOINT ["bun", "/app/src/main.ts"]
Binary file added packages/action/bun.lockb
Binary file not shown.
10 changes: 10 additions & 0 deletions packages/action/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "module",
"dependencies": {
"octokit": "^4.0.2",
"ora": "^8.1.0"
},
"devDependencies": {
"typescript": "^5.6.2"
}
}
5 changes: 5 additions & 0 deletions packages/action/src/libs/octokit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Octokit } from "octokit";

export default async function loadOctokit() {
return new Octokit({ auth: process.env.GH_TOKEN });
}
3 changes: 3 additions & 0 deletions packages/action/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(async () => {
console.log("Hello, world!");
})();
17 changes: 17 additions & 0 deletions packages/action/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"strict": true,
"pretty": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"moduleResolution": "NodeNext",
"module": "NodeNext",
"target": "ESNext",
"rootDir": "src",
"outDir": "build"
},
"include": ["src/**/*.ts"]
}

0 comments on commit 7f855dc

Please sign in to comment.