chore: update ahead-of-time build docs for Deno Deploy (#2381)

Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
Luca Casonato
2024-03-22 22:19:17 +01:00
committed by GitHub
co-authored by Marvin Hagemeister
parent 13d514dab8
commit 29d582c987
6 changed files with 19 additions and 154 deletions
-35
View File
@@ -37,38 +37,3 @@ export function tailwindImports(imports: Record<string, string>) {
export function dotenvImports(imports: Record<string, string>) {
imports["$std/"] = `https://deno.land/std@${RECOMMENDED_STD_VERSION}/`;
}
export const AOT_GH_ACTION = `name: Deploy
on:
push:
branches: [main]
pull_request:
branches: main
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Build step
run: "deno task build" # 📝 Update the build command(s) if necessary
- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
with:
project: "example-project" # 📝 Update the deploy project name if necessary
entrypoint: "./main.ts" # 📝 Update the entrypoint if necessary
`;
+3 -50
View File
@@ -1,5 +1,3 @@
import { AOT_GH_ACTION } from "../dev/imports.ts";
const LINK = "https://fresh.deno.dev/docs/concepts/ahead-of-time-builds";
export default function TailwindErrorPage() {
@@ -18,63 +16,18 @@ export default function TailwindErrorPage() {
<code>Settings</code> tab.
</li>
<li>
Set Git-Integration to <code>GitHub Action</code>.<br />
<i style="display: block; font-style: italic; color: gray;">
Unlink the repository first if it is already linked via{" "}
<code>Automatic</code> and re-link it again.
</i>
</li>
<li>
Add the file <code>.github/workflows/deploy.yml</code>{" "}
to your repository with the following contents:<br />
<span style="background: #f0f0f0;display: block; position: relative;">
<button
id="copy-gh-action"
style="position: absolute; top: .5rem; right: .5rem;z-index: 100"
>
copy code
</button>
<pre style="height: 200px; overflow: auto;padding: 1rem;"><code>{AOT_GH_ACTION}</code></pre>
</span>
</li>
<li>
Copy the project name under <code>Setting {">"} Project Name</code>
In the Git Integration section, enter <code>deno task build</code>
{" "}
and replace "example project" with your actual project name in{" "}
<code>.github/workflows/deploy.yml</code>.
in the <code>Build Command</code> input.
</li>
<li>
Commit the file you created and merge it into the <code>main</code>
{" "}
branch. This will trigger a new deployment and finish the setup.
Save the changes.
</li>
</ol>
<p>
See the detailed guide here: <a href={LINK}>{LINK}</a>.
</p>
</div>
<script
dangerouslySetInnerHTML={{
__html: `
const copyBtn = document.querySelector("#copy-gh-action");
if (copyBtn) {
let timeout;
const text = copyBtn.textContent;
copyBtn.addEventListener("click", async () => {
copyBtn.textContent = "copied!";
clearTimeout(timeout);
timeout = setTimeout(() => {
copyBtn.textContent = text
}, 2000);
const code = \`${AOT_GH_ACTION}\`;
await navigator.clipboard.writeText(code);
})
}
`,
}}
/>
</div>
);
}