Skip to content

Commit 8c0b201

Browse files
authored
draft-dagger (#32)
1 parent aa65bb0 commit 8c0b201

5 files changed

Lines changed: 88 additions & 50 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
nanoId: qs05qpu3c0p78ww123zv1
3+
title: How I added dagger.io
4+
date: 2024-04-18
5+
wip: true
6+
---
7+
8+
I wanted to have the ability to run CI/CD pipelines on my local, and I decided to go with [Dagger.io](https://dagger.io/). It not only fed my need and also added a lot of instresting features. In this post I'll share how I added dagger.io to my personal website.
9+
10+
## Requirements
11+
12+
My personal website is a static site generated using [Gatsby](https://www.gatsbyjs.com/). I have some scripts that I run locally to lint, build and publish the site, they are located in `scripts` directory.
13+
14+
I'm hosting my website on [Github Pages](https://pages.github.com/), using 3 environments: `development`, `staging` and `production`. These environments are hosted on:
15+
16+
- `Development`: [https://dev-n8v.github.io/](https://dev-n8v.github.io/)
17+
- `Staging`: [https://stg-n8v.github.io/](https://stg-n8v.github.io/)
18+
- `Production`: [https://ndthanhdev.github.io/](https://ndthanhdev.github.io/)
19+
20+
I want to apply "Trunk Based Development", so whenever I push a commit to `main` branch, the site should be published to `development`. Whenever a merge request is merged to `release-<version>` branch, the site should be published to `staging`. And when I create a release(a tag), the site should be published to `production`.
21+
22+
{/* Add a pic */}

app/content/posts/personal-website/p1.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
nanoId: ucxy00ef02qe3z4sn5vop
33
title: (wip) How I built my personal website (Part 1)
44
date: 2024-04-12
5+
wip: true
56
---
67

78
In this series of posts, I'll take you through the process of how I built my own website, exploring the tools, technologies, and decisions I made along the way.

app/src/components/templates/post/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ export const PostTemplate = ({
1717
<>
1818
<AppHeader {...appHeaderProps} />
1919
<AppDrawer {...appDrawerProps} />
20-
<Container maxWidth="lg">{children}</Container>
20+
<Container maxWidth="md">{children}</Container>
2121
</>
2222
);

app/src/gatsby-types.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,7 @@ type MdxFrontmatter = {
13431343
readonly date: Maybe<Scalars['Date']>;
13441344
readonly nanoId: Maybe<Scalars['String']>;
13451345
readonly title: Maybe<Scalars['String']>;
1346+
readonly wip: Maybe<Scalars['Boolean']>;
13461347
};
13471348

13481349

@@ -1357,18 +1358,21 @@ type MdxFrontmatterFieldSelector = {
13571358
readonly date: InputMaybe<FieldSelectorEnum>;
13581359
readonly nanoId: InputMaybe<FieldSelectorEnum>;
13591360
readonly title: InputMaybe<FieldSelectorEnum>;
1361+
readonly wip: InputMaybe<FieldSelectorEnum>;
13601362
};
13611363

13621364
type MdxFrontmatterFilterInput = {
13631365
readonly date: InputMaybe<DateQueryOperatorInput>;
13641366
readonly nanoId: InputMaybe<StringQueryOperatorInput>;
13651367
readonly title: InputMaybe<StringQueryOperatorInput>;
1368+
readonly wip: InputMaybe<BooleanQueryOperatorInput>;
13661369
};
13671370

13681371
type MdxFrontmatterSortInput = {
13691372
readonly date: InputMaybe<SortOrderEnum>;
13701373
readonly nanoId: InputMaybe<SortOrderEnum>;
13711374
readonly title: InputMaybe<SortOrderEnum>;
1375+
readonly wip: InputMaybe<SortOrderEnum>;
13721376
};
13731377

13741378
type MdxGroupConnection = {

app/src/providers/mdx-provider.tsx

Lines changed: 60 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { MDXProvider } from "@mdx-js/react";
2+
import Link from "@mui/material/Link";
23
import Typography from "@mui/material/Typography";
34
import * as React from "react";
45

@@ -7,55 +8,65 @@ import { AppTheme } from "@/theme";
78
export type AppMDXProviderProps = React.PropsWithChildren<object>;
89

910
/* eslint-disable @typescript-eslint/no-explicit-any */
10-
const h1 = (props: any) => <Typography gutterBottom variant="h1" {...props} />,
11-
h2 = (props: any) => <Typography gutterBottom variant="h2" {...props} />,
12-
h3 = (props: any) => <Typography gutterBottom variant="h3" {...props} />,
13-
h4 = (props: any) => <Typography gutterBottom variant="h4" {...props} />,
14-
h5 = (props: any) => <Typography gutterBottom variant="h5" {...props} />,
15-
h6 = (props: any) => <Typography gutterBottom variant="h6" {...props} />,
16-
text = (props: any) => <Typography variant="body1" {...props} />,
17-
strong = (props: any) => (
18-
<Typography
19-
variant="body1"
20-
css={(theme: AppTheme) => ({
21-
fontWeight: theme.typography.fontWeightBold,
22-
})}
23-
{...props}
24-
/>
25-
),
26-
p = (props: any) => (
27-
<Typography
28-
{...props}
29-
variant="body1"
30-
paragraph
31-
css={(theme: AppTheme) => ({
32-
marginBlockEnd: theme.spacing(1),
33-
})}
34-
/>
35-
),
36-
ul = (props: any) => (
37-
<ul
38-
{...props}
39-
css={(theme: AppTheme) => ({
40-
marginBlockStart: theme.spacing(0),
41-
marginBlockEnd: theme.spacing(2),
42-
})}
43-
/>
44-
),
45-
li = (props: any) => <li {...props} css={{}} />,
46-
defaultComponents = {
47-
text,
48-
p,
49-
h1,
50-
h2,
51-
h3,
52-
h4,
53-
h5,
54-
h6,
55-
strong,
56-
ul,
57-
li,
58-
} satisfies React.ComponentProps<typeof MDXProvider>["components"];
11+
const h1 = (props: any) => <Typography gutterBottom variant="h3" {...props} />;
12+
const h2 = (props: any) => <Typography gutterBottom variant="h4" {...props} />;
13+
const h3 = (props: any) => <Typography gutterBottom variant="h5" {...props} />;
14+
const h4 = (props: any) => <Typography gutterBottom variant="h6" {...props} />;
15+
const h5 = (props: any) => <Typography gutterBottom variant="h7" {...props} />;
16+
const h6 = (props: any) => (
17+
<Typography gutterBottom variant="subtitle1" {...props} />
18+
);
19+
const text = (props: any) => <Typography variant="body1" {...props} />;
20+
21+
const strong = (props: any) => (
22+
<Typography
23+
variant="body1"
24+
css={(theme: AppTheme) => ({
25+
fontWeight: theme.typography.fontWeightBold,
26+
})}
27+
{...props}
28+
/>
29+
);
30+
31+
const p = (props: any) => (
32+
<Typography
33+
{...props}
34+
variant="body1"
35+
paragraph
36+
css={(theme: AppTheme) => ({
37+
marginBlockEnd: theme.spacing(1),
38+
})}
39+
/>
40+
);
41+
42+
const ul = (props: any) => (
43+
<ul
44+
{...props}
45+
css={(theme: AppTheme) => ({
46+
marginBlockStart: theme.spacing(0),
47+
marginBlockEnd: theme.spacing(2),
48+
})}
49+
/>
50+
);
51+
52+
const li = (props: any) => <li {...props} css={{}} />;
53+
54+
const a = (props: any) => <Link {...props} />;
55+
56+
const defaultComponents = {
57+
text,
58+
p,
59+
h1,
60+
h2,
61+
h3,
62+
h4,
63+
h5,
64+
h6,
65+
strong,
66+
ul,
67+
li,
68+
a,
69+
} satisfies React.ComponentProps<typeof MDXProvider>["components"];
5970
/* eslint-enable @typescript-eslint/no-explicit-any */
6071

6172
export const AppMDXProvider = ({ children }: AppMDXProviderProps) => (

0 commit comments

Comments
 (0)