From ca840fdcc6d7548d3841d4cb033f30ba4cc8e2df Mon Sep 17 00:00:00 2001 From: Angelo Thys Date: Sun, 12 May 2024 15:22:40 +0100 Subject: [PATCH] Install tinacms cloud backend - Add tinacms admin build step in github deploy workflow - Rename .tina folder back to tina --- .github/workflows/deploy.yml | 5 +++ content/posts/hello-world.md | 9 +++++ package-lock.json | 16 +++++++-- {.tina => tina}/.gitignore | 0 tina/.tina/.gitignore | 1 + {.tina => tina/.tina}/config.ts | 0 {.tina => tina/.tina}/tina-lock.json | 0 tina/config.ts | 53 ++++++++++++++++++++++++++++ 8 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 content/posts/hello-world.md rename {.tina => tina}/.gitignore (100%) create mode 100644 tina/.tina/.gitignore rename {.tina => tina/.tina}/config.ts (100%) rename {.tina => tina/.tina}/tina-lock.json (100%) create mode 100644 tina/config.ts diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 77090f0..3114c71 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,6 +15,11 @@ permissions: id-token: write jobs: + build-tinacms-admin: + env: + TINA_PUBLIC_CLIENT_ID: ${{ secrets.TINA_PUBLIC_CLIENT_ID }} + TINA_TOKEN: ${{ secrets.TINA_TOKEN }} + run: npx tinacms build build: runs-on: ubuntu-latest steps: diff --git a/content/posts/hello-world.md b/content/posts/hello-world.md new file mode 100644 index 0000000..f3639e2 --- /dev/null +++ b/content/posts/hello-world.md @@ -0,0 +1,9 @@ +--- +title: Hello, World! +--- + +## Hello World! + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut non lorem diam. Quisque vulputate nibh sodales eros pretium tincidunt. Aenean porttitor efficitur convallis. Nulla sagittis finibus convallis. Phasellus in fermentum quam, eu egestas tortor. Maecenas ac mollis leo. Integer maximus eu nisl vel sagittis. + +Suspendisse facilisis, mi ac scelerisque interdum, ligula ex imperdiet felis, a posuere eros justo nec sem. Nullam laoreet accumsan metus, sit amet tincidunt orci egestas nec. Pellentesque ut aliquet ante, at tristique nunc. Donec non massa nibh. Ut posuere lacus non aliquam laoreet. Fusce pharetra ligula a felis porttitor, at mollis ipsum maximus. Donec quam tortor, vehicula a magna sit amet, tincidunt dictum enim. In hac habitasse platea dictumst. Mauris sit amet ornare ligula, blandit consequat risus. Duis malesuada pellentesque lectus, non feugiat turpis eleifend a. Nullam tempus ante et diam pretium, ac faucibus ligula interdum. diff --git a/package-lock.json b/package-lock.json index 2367456..e7c58b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5298,7 +5298,7 @@ "version": "1.3.101", "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.101.tgz", "integrity": "sha512-w5aQ9qYsd/IYmXADAnkXPGDMTqkQalIi+kfFf/MHRKTpaOL7DHjMXwPp/n8hJ0qNjRvchzmPtOqtPBiER50d8A==", - "devOptional": true, + "dev": true, "hasInstallScript": true, "dependencies": { "@swc/counter": "^0.1.1", @@ -5339,6 +5339,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "darwin" @@ -5354,6 +5355,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "darwin" @@ -5369,6 +5371,7 @@ "cpu": [ "arm" ], + "dev": true, "optional": true, "os": [ "linux" @@ -5384,6 +5387,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -5399,6 +5403,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -5414,6 +5419,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -5429,6 +5435,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "linux" @@ -5444,6 +5451,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "win32" @@ -5459,6 +5467,7 @@ "cpu": [ "ia32" ], + "dev": true, "optional": true, "os": [ "win32" @@ -5474,6 +5483,7 @@ "cpu": [ "x64" ], + "dev": true, "optional": true, "os": [ "win32" @@ -5486,7 +5496,7 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.2.tgz", "integrity": "sha512-9F4ys4C74eSTEUNndnER3VJ15oru2NumfQxS8geE+f3eB5xvfxpWyqE5XlVnxb/R14uoXi6SLbBwwiDSkv+XEw==", - "devOptional": true + "dev": true }, "node_modules/@swc/helpers": { "version": "0.5.11", @@ -5500,7 +5510,7 @@ "version": "0.1.5", "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.5.tgz", "integrity": "sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==", - "devOptional": true + "dev": true }, "node_modules/@tailwindcss/aspect-ratio": { "version": "0.4.2", diff --git a/.tina/.gitignore b/tina/.gitignore similarity index 100% rename from .tina/.gitignore rename to tina/.gitignore diff --git a/tina/.tina/.gitignore b/tina/.tina/.gitignore new file mode 100644 index 0000000..ef208df --- /dev/null +++ b/tina/.tina/.gitignore @@ -0,0 +1 @@ +__generated__ \ No newline at end of file diff --git a/.tina/config.ts b/tina/.tina/config.ts similarity index 100% rename from .tina/config.ts rename to tina/.tina/config.ts diff --git a/.tina/tina-lock.json b/tina/.tina/tina-lock.json similarity index 100% rename from .tina/tina-lock.json rename to tina/.tina/tina-lock.json diff --git a/tina/config.ts b/tina/config.ts new file mode 100644 index 0000000..32aff27 --- /dev/null +++ b/tina/config.ts @@ -0,0 +1,53 @@ +import { defineConfig } from "tinacms"; + +// Your hosting provider likely exposes this as an environment variable +const branch = + process.env.GITHUB_BRANCH || + process.env.VERCEL_GIT_COMMIT_REF || + process.env.HEAD || + "main"; + +export default defineConfig({ + branch, + + // Get this from tina.io + clientId: process.env.NEXT_PUBLIC_TINA_CLIENT_ID, + // Get this from tina.io + token: process.env.TINA_TOKEN, + + build: { + outputFolder: "admin", + publicFolder: "public", + }, + media: { + tina: { + mediaRoot: "", + publicFolder: "public", + }, + }, + // See docs on content modeling for more info on how to setup new content models: https://tina.io/docs/schema/ + schema: { + collections: [ + { + name: "post", + label: "Posts", + path: "content/posts", + fields: [ + { + type: "string", + name: "title", + label: "Title", + isTitle: true, + required: true, + }, + { + type: "rich-text", + name: "body", + label: "Body", + isBody: true, + }, + ], + }, + ], + }, +});