|
1 | 1 | // Copyright 2024 the JSR authors. All rights reserved. MIT license.
|
| 2 | +// deno-lint-ignore-file react-no-danger |
2 | 3 | import { HttpError, RouteConfig } from "fresh";
|
3 | 4 | import type { FullUser, Package } from "../../utils/api_types.ts";
|
4 | 5 | import { define } from "../../util.ts";
|
@@ -160,6 +161,25 @@ export default define.page<typeof handler>(function PackagePage({
|
160 | 161 | );
|
161 | 162 | });
|
162 | 163 |
|
| 164 | +const WORKFLOW_CODE = `\ |
| 165 | +name: Publish |
| 166 | +on: |
| 167 | + push: |
| 168 | + branches: |
| 169 | + - main |
| 170 | +
|
| 171 | +jobs: |
| 172 | + publish: |
| 173 | + runs-on: ubuntu-latest |
| 174 | + <span class='bg-[rgba(134,239,172,.25)] text-[rgba(190,242,100)]'>permissions:</span> |
| 175 | + <span class='bg-[rgba(134,239,172,.25)] text-[rgba(190,242,100)]'> contents: read</span> |
| 176 | + <span class='bg-[rgba(134,239,172,.25)] text-[rgba(190,242,100)]'> id-token: write</span> |
| 177 | + steps: |
| 178 | + - uses: actions/checkout@v4 |
| 179 | + <span class='bg-[rgba(134,239,172,.25)] text-[rgba(190,242,100)]'> - name: Publish package</span> |
| 180 | + <span class='bg-[rgba(134,239,172,.25)] text-[rgba(190,242,100)]'> run: npx jsr publish</span> |
| 181 | +`; |
| 182 | + |
163 | 183 | function GitHubActions({ pkg, canEdit, user }: {
|
164 | 184 | pkg: Package;
|
165 | 185 | canEdit: boolean;
|
@@ -244,27 +264,15 @@ function GitHubActions({ pkg, canEdit, user }: {
|
244 | 264 | title="Copy workflow path"
|
245 | 265 | />
|
246 | 266 | </div>
|
247 |
| - <pre class="bg-slate-900 dark:bg-slate-800 text-white rounded-lg rounded-tl-none p-4 mb-2 w-full max-w-full overflow-auto"> |
248 |
| - <code> |
249 |
| - {`\ |
250 |
| -name: Publish |
251 |
| -on: |
252 |
| - push: |
253 |
| - branches: |
254 |
| - - main |
255 |
| -
|
256 |
| -jobs: |
257 |
| - publish: |
258 |
| - runs-on: ubuntu-latest |
259 |
| -\n`} |
260 |
| - <span class="bg-[rgba(134,239,172,.25)] text-[rgba(190,242,100)]">{` permissions:\n`}</span> |
261 |
| - <span class="bg-[rgba(134,239,172,.25)] text-[rgba(190,242,100)]">{` contents: read\n`}</span> |
262 |
| - <span class="bg-[rgba(134,239,172,.25)] text-[rgba(190,242,100)]">{` id-token: write\n`}</span> |
263 |
| - {` |
264 |
| - steps: |
265 |
| - - uses: actions/checkout@v4\n\n`} |
266 |
| - <span class="bg-[rgba(134,239,172,.25)] text-[rgba(190,242,100)]">{` - name: Publish package\n`}</span> |
267 |
| - <span class="bg-[rgba(134,239,172,.25)] text-[rgba(190,242,100)]">{` run: npx jsr publish\n`}</span> |
| 267 | + <pre class="bg-slate-900 text-white rounded-lg rounded-tl-none p-4 mb-2 w-full max-w-full overflow-auto relative"> |
| 268 | + <div class="bg-white dark:bg-jsr-gray-900 text-white rounded p-0.5 absolute top-2 right-2 z-1 size-8 flex justify-center items-center"> |
| 269 | + <CopyButton |
| 270 | + text={WORKFLOW_CODE.replace(/<[^>]+>/g, '')} |
| 271 | + title="Copy workflow code" |
| 272 | + /> |
| 273 | + </div> |
| 274 | + <code |
| 275 | + dangerouslySetInnerHTML={{__html: WORKFLOW_CODE}}> |
268 | 276 | </code>
|
269 | 277 | </pre>
|
270 | 278 |
|
|
0 commit comments