feat: trying to optimize builds
All checks were successful
Deploy to SFTP Server / build (push) Successful in 20m53s
All checks were successful
Deploy to SFTP Server / build (push) Successful in 20m53s
This commit is contained in:
16
.github/workflows/default.yaml
vendored
16
.github/workflows/default.yaml
vendored
@@ -20,15 +20,13 @@ jobs:
|
||||
- name: 🔄 Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 🔢 Calculate cache IDs
|
||||
- name: 🔢 Prepare cache keys
|
||||
run: |
|
||||
# Calculate cache IDs for Git LFS and PNPM
|
||||
# Calculate cache IDs for Git LFS
|
||||
git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
|
||||
LFS_CACHE_ID=$(cat .lfs-assets-id | md5sum)-v1
|
||||
PNPM_CACHE_ID=$(cat pnpm-lock.yaml | md5sum)-v1
|
||||
echo "LFS_CACHE_ID=$LFS_CACHE_ID" >> $GITHUB_ENV
|
||||
echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV
|
||||
echo "PNPM_CACHE_ID=$PNPM_CACHE_ID" >> $GITHUB_ENV
|
||||
|
||||
- name: 🗄️ Cache Git LFS objects
|
||||
uses: actions/cache@v4
|
||||
@@ -41,12 +39,16 @@ jobs:
|
||||
with:
|
||||
path: ${{ env.PNPM_STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: 📷 Cache Astro Images
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: node_modules/.astro
|
||||
key: ${{ runner.os }}-astro-v1
|
||||
key: ${{ runner.os }}-astro-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-astro-
|
||||
|
||||
- name: 🔄 Pull Git LFS files
|
||||
run: git lfs pull
|
||||
@@ -70,8 +72,8 @@ jobs:
|
||||
- name: 🚀 Deploy Changed Files via rclone
|
||||
run: |
|
||||
echo "Uploading _astro assets"
|
||||
rclone sync --update -v --progress --size-only --stats 2s --stats-one-line ./dist/_astro sftp-remote:${REMOTE_DIR}/_astro --transfers 4
|
||||
rclone sync --update -v --progress --size-only --fast-list --stats 2s --stats-one-line ./dist/_astro sftp-remote:${REMOTE_DIR}/_astro --transfers 4
|
||||
echo "Uploading the rest"
|
||||
rclone sync --update -v --progress --exclude _astro/** --stats 2s --stats-one-line ./dist/ sftp-remote:${REMOTE_DIR} --transfers 4
|
||||
rclone sync --update -v --progress --exclude _astro/** --fast-list --stats 2s --stats-one-line ./dist/ sftp-remote:${REMOTE_DIR} --transfers 4
|
||||
env:
|
||||
REMOTE_DIR: ${{ vars.REMOTE_DIR }}
|
||||
|
||||
@@ -65,6 +65,7 @@ const link = translatePath(`/${collection}/${id.split("/")[0]}`);
|
||||
src={cover as ImageMetadata}
|
||||
alt={"cover for " + title}
|
||||
class="right-0 h-full object-cover object-center rounded-none border-l border-neutral"
|
||||
thumbnail
|
||||
/>
|
||||
</a>
|
||||
)
|
||||
|
||||
@@ -12,6 +12,7 @@ interface Props {
|
||||
hash?: boolean;
|
||||
loader?: boolean;
|
||||
maxWidth?: number;
|
||||
thumbnail?: boolean;
|
||||
}
|
||||
|
||||
async function checkImage(image: ImageMetadata) {
|
||||
@@ -41,16 +42,17 @@ const {
|
||||
hash = true,
|
||||
alt,
|
||||
maxWidth,
|
||||
thumbnail = false,
|
||||
} = Astro.props;
|
||||
|
||||
|
||||
|
||||
const imageOk = await checkImage(image);
|
||||
const imageBuffer = imageOk && await getImageBuffer(image);
|
||||
const imageBuffer = imageOk && (await getImageBuffer(image));
|
||||
let thumbhash = imageBuffer && (await generateThumbHash(imageBuffer));
|
||||
let exif = imageBuffer && (await getExifData(imageBuffer));
|
||||
|
||||
const sizes = [
|
||||
const definedSizes = [
|
||||
{
|
||||
width: 240,
|
||||
media: "(max-width: 360px)",
|
||||
@@ -66,7 +68,11 @@ const sizes = [
|
||||
{
|
||||
width: image.width,
|
||||
},
|
||||
].filter((size) => !maxWidth || size.width <= maxWidth);
|
||||
];
|
||||
|
||||
const sizes = thumbnail
|
||||
? [definedSizes[0]]
|
||||
: definedSizes.filter((size) => !maxWidth || size.width <= maxWidth);
|
||||
---
|
||||
|
||||
{
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
---
|
||||
interface Props {
|
||||
title: string;
|
||||
cover: string;
|
||||
cover?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
const {
|
||||
title,
|
||||
cover,
|
||||
description = "A personal blog and portfolio by Max Richter.",
|
||||
} = Astro.props;
|
||||
---
|
||||
|
||||
<meta property="og:title" content={Astro.props.title} />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content={Astro.url} />
|
||||
<meta property="og:image" content={Astro.props.cover} />
|
||||
<meta property="og:description" content="Max Richters personal blog" />
|
||||
{cover && <meta property="og:image" content={cover} />}
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:site_name" content="Max Richter" />
|
||||
|
||||
@@ -3,6 +3,7 @@ import { getCollection, render } from "astro:content";
|
||||
import { getLocale } from "astro-i18n-aut";
|
||||
import { filterCollection, parseSlug } from "@i18n/utils";
|
||||
import MetaTags from "@components/MetaTags.astro";
|
||||
import { markdownToText } from "@helpers/markdown";
|
||||
|
||||
const locale = getLocale(Astro.url);
|
||||
|
||||
@@ -32,5 +33,9 @@ if (!page) {
|
||||
const { Content } = await render(page);
|
||||
---
|
||||
|
||||
<MetaTags title={page.data.title} cover={page.data.cover?.src} />
|
||||
<MetaTags
|
||||
title={page.data.title}
|
||||
cover={page.data.cover?.src}
|
||||
description={page.data.description || markdownToText(page.body).slice(0, 200)}
|
||||
/>
|
||||
<Content />
|
||||
|
||||
@@ -3,6 +3,7 @@ import { getCollection, render } from "astro:content";
|
||||
import { getLocale } from "astro-i18n-aut";
|
||||
import { filterCollection, parseSlug } from "@i18n/utils";
|
||||
import MetaTags from "@components/MetaTags.astro";
|
||||
import { markdownToText } from "@helpers/markdown";
|
||||
|
||||
const locale = getLocale(Astro.url);
|
||||
|
||||
@@ -32,5 +33,9 @@ if (!page) {
|
||||
const { Content } = await render(page);
|
||||
---
|
||||
|
||||
<MetaTags title={page.data.title} cover={page.data.cover?.src} />
|
||||
<MetaTags
|
||||
title={page.data.title}
|
||||
cover={page.data.cover?.src}
|
||||
description={page.data.description || markdownToText(page.body).slice(0, 200)}
|
||||
/>
|
||||
<Content />
|
||||
|
||||
Reference in New Issue
Block a user