@rm-industries/create-forge 0.4.0-beta.1 → 0.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/template/.github/workflows/automation.yml +20 -0
- package/dist/template/.github/workflows/project.yml +27 -0
- package/dist/template/README.md +14 -0
- package/dist/template/astro.config.ts +5 -1
- package/dist/template/docs/github-pages.md +56 -0
- package/dist/template/package-lock.json +420 -479
- package/dist/template/package.json +3 -3
- package/dist/template/src/components/navigation/Footer.astro +2 -1
- package/dist/template/src/components/navigation/Navbar.astro +9 -5
- package/dist/template/src/components/navigation/Pagination.astro +4 -2
- package/dist/template/src/components/seo/SeoHead.astro +7 -6
- package/dist/template/src/components/ui/Card.astro +5 -2
- package/dist/template/src/config/deployment.test.ts +16 -0
- package/dist/template/src/config/deployment.ts +14 -0
- package/dist/template/src/integrations/sveltia/config.ts +3 -2
- package/dist/template/src/lib/paths.test.ts +26 -0
- package/dist/template/src/lib/paths.ts +17 -0
- package/dist/template/src/pages/404.astro +2 -1
- package/dist/template/src/pages/about.astro +5 -1
- package/dist/template/src/pages/index.astro +4 -3
- package/dist/template/src/pages/rss.xml.ts +2 -1
- package/dist/template/src/pages/site.webmanifest.ts +3 -2
- package/package.json +3 -3
|
@@ -57,3 +57,23 @@ jobs:
|
|
|
57
57
|
|
|
58
58
|
- name: Validate workflows
|
|
59
59
|
uses: raven-actions/actionlint@3d39aea434753780c3b3d4a1a31c854b4dbf49d7 # v2
|
|
60
|
+
|
|
61
|
+
automation:
|
|
62
|
+
name: Automation
|
|
63
|
+
needs:
|
|
64
|
+
- security
|
|
65
|
+
- syntax
|
|
66
|
+
if: always()
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
|
|
69
|
+
steps:
|
|
70
|
+
- name: Confirm automation checks
|
|
71
|
+
env:
|
|
72
|
+
SECURITY_RESULT: ${{ needs.security.result }}
|
|
73
|
+
SYNTAX_RESULT: ${{ needs.syntax.result }}
|
|
74
|
+
run: |
|
|
75
|
+
if [[ "$SECURITY_RESULT" != 'success' || "$SYNTAX_RESULT" != 'success' ]]; then
|
|
76
|
+
echo '::error title=Automation validation failed::Workflow security and syntax checks must both pass.'
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
echo 'Workflow security and syntax checks passed.'
|
|
@@ -149,6 +149,12 @@ jobs:
|
|
|
149
149
|
if-no-files-found: error
|
|
150
150
|
retention-days: 7
|
|
151
151
|
|
|
152
|
+
- name: Upload GitHub Pages artifact
|
|
153
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
154
|
+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5
|
|
155
|
+
with:
|
|
156
|
+
path: dist
|
|
157
|
+
|
|
152
158
|
browser-tests:
|
|
153
159
|
name: Browser and accessibility tests
|
|
154
160
|
runs-on: ubuntu-latest
|
|
@@ -233,3 +239,24 @@ jobs:
|
|
|
233
239
|
steps:
|
|
234
240
|
- name: Confirm project checks
|
|
235
241
|
run: echo "All project checks passed."
|
|
242
|
+
|
|
243
|
+
deploy:
|
|
244
|
+
name: Deploy GitHub Pages
|
|
245
|
+
needs:
|
|
246
|
+
- build
|
|
247
|
+
- project
|
|
248
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
249
|
+
runs-on: ubuntu-latest
|
|
250
|
+
|
|
251
|
+
permissions:
|
|
252
|
+
pages: write
|
|
253
|
+
id-token: write
|
|
254
|
+
|
|
255
|
+
environment:
|
|
256
|
+
name: github-pages
|
|
257
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
258
|
+
|
|
259
|
+
steps:
|
|
260
|
+
- name: Deploy GitHub Pages
|
|
261
|
+
id: deployment
|
|
262
|
+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5
|
package/dist/template/README.md
CHANGED
|
@@ -62,6 +62,10 @@ The generated `.github/workflows/project.yml` runs on pull requests targeting
|
|
|
62
62
|
unit tests, the validated production build, browser and accessibility tests,
|
|
63
63
|
and Lighthouse budgets so failures identify the affected gate directly. The
|
|
64
64
|
required `Project` result succeeds only after every release-blocking job passes.
|
|
65
|
+
On pushes to `main`, that result unlocks a separate GitHub Pages deployment;
|
|
66
|
+
pull requests never upload or deploy a Pages artifact. Deployment setup,
|
|
67
|
+
project-site URLs, custom domains, and environment protections are documented in
|
|
68
|
+
[`docs/github-pages.md`](docs/github-pages.md).
|
|
65
69
|
|
|
66
70
|
The workflow installs dependencies with `npm ci`, caches npm downloads using
|
|
67
71
|
the lockfile, cancels superseded runs on the same Git reference, and grants only
|
|
@@ -80,6 +84,10 @@ Security tab without failing the workflow solely because it found an issue.
|
|
|
80
84
|
The job receives `security-events: write` only for that upload; all other access
|
|
81
85
|
remains read-only. Repositories can make selected code-scanning severities
|
|
82
86
|
merge-blocking later through their ruleset without changing the workflow.
|
|
87
|
+
The `Automation` aggregate runs when `.github/**` changes and succeeds only after
|
|
88
|
+
both workflow syntax and security validation pass. Because it is path-filtered,
|
|
89
|
+
do not configure it as a globally required status check; review it whenever an
|
|
90
|
+
automation change causes it to appear.
|
|
83
91
|
|
|
84
92
|
Dependabot checks npm and GitHub Actions weekly. Minor and patch npm updates are
|
|
85
93
|
grouped by production or development scope, while major updates remain separate
|
|
@@ -141,6 +149,12 @@ configuration, shared layout, and reusable SEO head consume this single
|
|
|
141
149
|
validated source. New pages should use `src/layouts/BaseLayout.astro` to inherit
|
|
142
150
|
the document shell and canonical metadata.
|
|
143
151
|
|
|
152
|
+
The canonical URL may include a pathname for a GitHub Pages project site, such
|
|
153
|
+
as `https://owner.github.io/repository`. The Astro configuration derives its
|
|
154
|
+
deployment base from that pathname, and shared URL helpers apply it to local
|
|
155
|
+
navigation, metadata, supporting files, and assets. Root-hosted and custom-domain
|
|
156
|
+
sites use an origin-only URL and therefore have no deployment prefix.
|
|
157
|
+
|
|
144
158
|
The standalone source template uses `https://example.com` as a valid,
|
|
145
159
|
non-production site origin. Projects created by Forge receive the values
|
|
146
160
|
selected through the generator input contract.
|
|
@@ -2,12 +2,16 @@ import sitemap from '@astrojs/sitemap';
|
|
|
2
2
|
import tailwindcss from '@tailwindcss/vite';
|
|
3
3
|
import { defineConfig } from 'astro/config';
|
|
4
4
|
|
|
5
|
+
import { getDeploymentConfig } from './src/config/deployment';
|
|
5
6
|
import { site } from './src/config/site';
|
|
6
7
|
|
|
8
|
+
const deployment = getDeploymentConfig(site.url);
|
|
9
|
+
|
|
7
10
|
export default defineConfig({
|
|
11
|
+
base: deployment.base,
|
|
8
12
|
integrations: [sitemap()],
|
|
9
13
|
output: 'static',
|
|
10
|
-
site: site
|
|
14
|
+
site: deployment.site,
|
|
11
15
|
trailingSlash: 'always',
|
|
12
16
|
vite: {
|
|
13
17
|
plugins: [tailwindcss()],
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# GitHub Pages deployment
|
|
2
|
+
|
|
3
|
+
The project workflow publishes the validated production build to GitHub Pages
|
|
4
|
+
after every push to `main`. Pull requests build and test the site, but they do
|
|
5
|
+
not upload a Pages artifact or run a deployment.
|
|
6
|
+
|
|
7
|
+
## Enable deployment
|
|
8
|
+
|
|
9
|
+
1. Open the repository's **Settings → Pages** page.
|
|
10
|
+
2. Under **Build and deployment**, select **GitHub Actions** as the source.
|
|
11
|
+
3. Open **Settings → Environments → github-pages** after its first appearance.
|
|
12
|
+
4. Restrict deployment branches to `main`. Add required reviewers when the site
|
|
13
|
+
needs a manual production approval.
|
|
14
|
+
|
|
15
|
+
The build job has read-only repository access. The separate deployment job is
|
|
16
|
+
the only job granted `pages: write` and `id-token: write`, and it cannot begin
|
|
17
|
+
until the complete `Project` quality gate succeeds.
|
|
18
|
+
|
|
19
|
+
## Choose the public URL
|
|
20
|
+
|
|
21
|
+
Set `url` in `src/config/site.ts` to the complete public address. Forge derives
|
|
22
|
+
Astro's deployment base from this value, so canonical metadata, navigation,
|
|
23
|
+
assets, the RSS feed, the web manifest, and CMS branding use the same path.
|
|
24
|
+
|
|
25
|
+
For a project site, include the repository name:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
url: 'https://owner.github.io/repository',
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For an organization or user site, use the root address:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
url: 'https://owner.github.io',
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Run `npm run build && npm run validate:build` after changing the URL. Once the
|
|
38
|
+
workflow succeeds on `main`, its deployment summary links to the published site.
|
|
39
|
+
|
|
40
|
+
## Use a custom domain
|
|
41
|
+
|
|
42
|
+
Set the site URL to the custom origin without a repository pathname:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
url: 'https://www.example.com',
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Add `public/CNAME` containing only the domain name, configure the same domain in
|
|
49
|
+
**Settings → Pages**, and create the DNS records GitHub documents for the chosen
|
|
50
|
+
domain. The template does not include a `CNAME` file because generated projects
|
|
51
|
+
do not share a domain. Enable **Enforce HTTPS** after GitHub verifies the DNS
|
|
52
|
+
configuration.
|
|
53
|
+
|
|
54
|
+
Do not configure both a repository pathname and a custom domain. A custom domain
|
|
55
|
+
is served from its root, while a project site uses the repository name as its
|
|
56
|
+
base path.
|