Skip to content

Commit

Permalink
chore(cd): added deploy on cloudflare pages
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinTh committed Oct 2, 2024
1 parent f8b5cbf commit 44526a9
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 5 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/cd-app-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CD - Production

on:
push:
branches:
- next

jobs:
publish-app-prod:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Publish app to production
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 22
corepack: true
cache: 'pnpm'

- name: Install dependencies
run: pnpm i

- name: Build the app
run: pnpm -F @it-tools/app build

- name: Publish to Cloudflare Pages
uses: AdrianGonz97/refined-cf-pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
projectName: it-tools
workingDirectory: packages/app
directory: dist
deploymentName: Production App
branch: next
wranglerVersion: '3'


1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# IT-Tools
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export const tokenGeneratorTool = defineTool({
entryFile: () => import('./token-generator.page'),
icon: 'i-tabler-key',
createdAt: new Date('2024-02-13'),
currentDirUrl: import.meta.url,
dirName: 'token-generator',
});
8 changes: 6 additions & 2 deletions packages/app/src/modules/tools/pages/tool.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ export const ToolPage: Component = () => {
const ToolComponent = lazy(toolDefinition.entryFile);

const [toolDict] = createResource(getLocale, async (locale) => {
const [dict = { default: {} }] = await safely(import(`../definitions/${toolDefinition.dirName}/locales/${locale}.json`));
const [dict, error] = await safely(import(`../definitions/${toolDefinition.dirName}/locales/${locale}.json`));

return dict;
if (error) {
console.error(error);
}

return dict ?? { default: {} };
});

return (
Expand Down
3 changes: 1 addition & 2 deletions packages/app/src/modules/tools/tools.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ export { defineTool };
function defineTool(toolDefinition: {
slug: string;
entryFile: () => Promise<{ default: Component }>;
currentDirUrl: string;
dirName: string;
icon: string;
createdAt: Date;
}) {
return {
...toolDefinition,
key: toolDefinition.slug,
dirName: toolDefinition.currentDirUrl.split('/').slice(-2)[0],
};
}

0 comments on commit 44526a9

Please sign in to comment.