build: add deployment cmd
This commit is contained in:
parent
300a28b76b
commit
8663544548
6 changed files with 42 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"extends": "next/core-web-vitals",
|
||||
"rules": {
|
||||
"@stylistic/jsx/jsx-pascal-case": "off"
|
||||
"@stylistic/jsx/jsx-pascal-case": "off",
|
||||
"@next/next/no-html-link-for-pages": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
output: 'export'
|
||||
output: 'export',
|
||||
trailingSlash: true // ensure pages get their own directory in output
|
||||
}
|
||||
|
||||
export default nextConfig
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
"start": "next start",
|
||||
"link": "npx standard",
|
||||
"format": "npx standard --fix",
|
||||
"prepare": "husky"
|
||||
"prepare": "husky",
|
||||
"deploy": "./util/deploy-gcloud.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "14.1.1",
|
||||
|
|
|
@ -13,7 +13,7 @@ export function getMarkdownEntry (path) {
|
|||
const converter = new showdown.Converter()
|
||||
const html = converter.makeHtml(body)
|
||||
|
||||
const slug = toSlug(path.substring(path.lastIndexOf('/')))
|
||||
const slug = toSlug(path.substring(path.lastIndexOf('/') + 1))
|
||||
|
||||
return {
|
||||
attributes,
|
||||
|
|
|
@ -28,8 +28,6 @@ export function getStaticPaths () {
|
|||
}
|
||||
}))
|
||||
|
||||
console.log(paths)
|
||||
|
||||
return {
|
||||
fallback: false,
|
||||
paths
|
||||
|
@ -38,6 +36,7 @@ export function getStaticPaths () {
|
|||
|
||||
export function getStaticProps ({ params }) {
|
||||
const path = `./content/fun/${params.slug}.md`
|
||||
|
||||
const entry = getMarkdownEntry(path)
|
||||
return { props: { ...entry } }
|
||||
}
|
||||
|
|
34
util/deploy-gcloud.sh
Executable file
34
util/deploy-gcloud.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
BUCKET_URL="gs://aaronjy-www"
|
||||
BACKUP_BUCKET_URL="gs://aaronjy-www-backup"
|
||||
|
||||
echo "------------------------------"
|
||||
echo "DELETING CURRENT SITE FILES"
|
||||
echo "------------------------------"
|
||||
|
||||
gcloud storage rm $BUCKET_URL/**
|
||||
|
||||
echo "------------------------------"
|
||||
echo "REMOVE SENSITIVE FILES"
|
||||
echo "------------------------------"
|
||||
|
||||
rm -rfv ./out/admin/
|
||||
|
||||
echo "Removed all sensitive files."
|
||||
|
||||
echo "------------------------------"
|
||||
echo "UPLOADING NEW SITE FILES"
|
||||
echo "------------------------------"
|
||||
|
||||
gcloud storage cp --recursive ./out/* $BUCKET_URL --gzip-in-flight-all
|
||||
|
||||
echo "------------------------------"
|
||||
echo "INVALIDATING GLOBAL CACHE"
|
||||
echo "------------------------------"
|
||||
|
||||
echo "WARNING: This is an async operation that can take upwards of 10 minutes depending on how fast Google Cloud CDN invalidates its cache. It does take around 10 minutes on average."
|
||||
|
||||
gcloud compute url-maps invalidate-cdn-cache lb-aaronjy-www --path "/*" --async
|
||||
|
||||
echo "------------------------------"
|
||||
echo "DONE!"
|
||||
echo "------------------------------"
|
Loading…
Add table
Reference in a new issue