spec-up-t 1.6.10 → 1.6.11
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/package.json +1 -1
- package/src/install-from-boilerplate/boilerplate/.github/workflows/menu.yml +13 -13
- package/src/install-from-boilerplate/boilerplate/.github/workflows/render-and-deploy.yml +109 -0
- package/src/install-from-boilerplate/boilerplate/.github/workflows/set-gh-pages.yml +42 -40
- package/src/install-from-boilerplate/boilerplate/gitignore +3 -0
- package/src/install-from-boilerplate/config-gitignore-entries.js +3 -1
- package/src/install-from-boilerplate/config-system-files.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.11",
|
|
4
4
|
"description": "Technical specification drafting tool that generates rich specification documents from markdown. Forked from https://github.com/decentralized-identity/spec-up by Daniel Buchner (https://github.com/csuwildcat)",
|
|
5
5
|
"main": "./index",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,8 @@ jobs:
|
|
|
33
33
|
build-and-deploy-spec:
|
|
34
34
|
runs-on: ubuntu-latest
|
|
35
35
|
permissions:
|
|
36
|
-
contents: write
|
|
36
|
+
contents: write # Needed for pushing changes
|
|
37
|
+
actions: write # Needed to dispatch render-and-deploy.yml
|
|
37
38
|
steps:
|
|
38
39
|
- name: Checkout 🛎️
|
|
39
40
|
uses: actions/checkout@v4
|
|
@@ -68,7 +69,14 @@ jobs:
|
|
|
68
69
|
run: |
|
|
69
70
|
case "${{ github.event.inputs.action_type }}" in
|
|
70
71
|
render)
|
|
71
|
-
|
|
72
|
+
# Rendering is handled by render-and-deploy.yml.
|
|
73
|
+
# Dispatch that workflow to render and deploy to GitHub Pages.
|
|
74
|
+
curl -s -X POST \
|
|
75
|
+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
76
|
+
-H "Accept: application/vnd.github+json" \
|
|
77
|
+
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/render-and-deploy.yml/dispatches" \
|
|
78
|
+
-d "{\"ref\":\"${{ github.ref_name }}\"}"
|
|
79
|
+
echo "render-and-deploy.yml dispatched"
|
|
72
80
|
;;
|
|
73
81
|
topdf)
|
|
74
82
|
npm run topdf
|
|
@@ -105,7 +113,8 @@ jobs:
|
|
|
105
113
|
# Commit with appropriate message
|
|
106
114
|
case "${{ github.event.inputs.action_type }}" in
|
|
107
115
|
render)
|
|
108
|
-
|
|
116
|
+
# render-and-deploy.yml already handles the commit/deploy; nothing to commit here.
|
|
117
|
+
echo "Render dispatched to render-and-deploy.yml — no direct commit needed"
|
|
109
118
|
;;
|
|
110
119
|
topdf)
|
|
111
120
|
git commit -m "Export to PDF" || echo "No changes to commit"
|
|
@@ -128,16 +137,7 @@ jobs:
|
|
|
128
137
|
esac
|
|
129
138
|
|
|
130
139
|
# Push changes
|
|
131
|
-
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD
|
|
132
|
-
|
|
133
|
-
- name: Commit output files
|
|
134
|
-
if: success()
|
|
135
|
-
run: |
|
|
136
|
-
git config --global user.email "actions@github.com"
|
|
137
|
-
git config --global user.name "GitHub Actions"
|
|
138
|
-
git add "$OUTPUT_PATH"
|
|
139
|
-
git commit -m "Update output files in $OUTPUT_PATH" || echo "No changes to commit in output directory"
|
|
140
|
-
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:main
|
|
140
|
+
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:${{ github.ref_name }}
|
|
141
141
|
|
|
142
142
|
- name: Clean up
|
|
143
143
|
if: always()
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
name: Render and Deploy to GitHub Pages
|
|
2
|
+
|
|
3
|
+
# Triggered automatically on every push to main or master, or manually via
|
|
4
|
+
# the Actions tab (or when dispatched by menu.yml for a render action).
|
|
5
|
+
# Renders the specification and pushes the output to the gh-pages branch.
|
|
6
|
+
# docs/ is NEVER committed to main/master.
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
- master
|
|
13
|
+
# Do not trigger on workflow file changes (.github/). Each workflow file
|
|
14
|
+
# is uploaded as a separate commit during repo creation, which would cause
|
|
15
|
+
# multiple competing runs in the same concurrency group. Real spec content
|
|
16
|
+
# changes (spec/, specs.json, package.json, etc.) still trigger a render.
|
|
17
|
+
# The initial render after repo creation is handled by an explicit dispatch.
|
|
18
|
+
# The trigger matrix is now:
|
|
19
|
+
#
|
|
20
|
+
# Event --> Triggers render?
|
|
21
|
+
#
|
|
22
|
+
# Push spec content (spec, specs.json, etc.) --> ✅ yes
|
|
23
|
+
# Push `.github/workflows/*.yml` (repo creation) --> ❌ no
|
|
24
|
+
# `workflow_dispatch` (GitHubUi "render" button, or menu.yml) --> ✅ yes
|
|
25
|
+
# PR into main/master --> ❌ not triggered (no `pull_request:` event)
|
|
26
|
+
|
|
27
|
+
paths-ignore:
|
|
28
|
+
- '.github/**'
|
|
29
|
+
workflow_dispatch:
|
|
30
|
+
|
|
31
|
+
# Only allow one deployment at a time; do not cancel in-progress runs so that
|
|
32
|
+
# a completed deploy is never replaced by a stale one.
|
|
33
|
+
# NOTE: do NOT use 'pages' as the group name — that conflicts with GitHub's own
|
|
34
|
+
# internal Pages deployment concurrency group and causes spurious cancellations.
|
|
35
|
+
concurrency:
|
|
36
|
+
group: render-and-deploy-${{ github.ref }}
|
|
37
|
+
cancel-in-progress: false
|
|
38
|
+
|
|
39
|
+
jobs:
|
|
40
|
+
# ── Build & Deploy ────────────────────────────────────────────────────────────
|
|
41
|
+
build-and-deploy:
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
# GitHub automatically generates a GITHUB_TOKEN for each workflow run.
|
|
44
|
+
# This ephemeral token is scoped only to the current repository and expires
|
|
45
|
+
# after the run completes. The 'permissions' block declares what this token
|
|
46
|
+
# is allowed to do — GitHub denies operations outside these scopes.
|
|
47
|
+
permissions:
|
|
48
|
+
contents: write # Required by peaceiris/actions-gh-pages to push to gh-pages
|
|
49
|
+
pages: write # Required to configure GitHub Pages source via API
|
|
50
|
+
steps:
|
|
51
|
+
- name: Checkout 🛎️
|
|
52
|
+
uses: actions/checkout@v4
|
|
53
|
+
|
|
54
|
+
- name: Set up Node.js
|
|
55
|
+
uses: actions/setup-node@v4
|
|
56
|
+
with:
|
|
57
|
+
node-version: '20'
|
|
58
|
+
|
|
59
|
+
- name: Install dependencies 🔧
|
|
60
|
+
run: npm install
|
|
61
|
+
|
|
62
|
+
# Collect external references — this also renders the specification and
|
|
63
|
+
# writes output to the path defined in specs.json (output_path, typically ./docs/).
|
|
64
|
+
- name: Collect external references and render
|
|
65
|
+
run: npm run collectExternalReferences
|
|
66
|
+
|
|
67
|
+
# Push the rendered ./docs output to the gh-pages branch.
|
|
68
|
+
# peaceiris/actions-gh-pages creates the branch on first run when it
|
|
69
|
+
# does not yet exist — no manual branch setup is required.
|
|
70
|
+
# Uses GITHUB_TOKEN (automatically injected by GitHub) with 'contents: write'
|
|
71
|
+
# permission to push to this repository.
|
|
72
|
+
- name: Deploy to GitHub Pages 🚀
|
|
73
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
74
|
+
with:
|
|
75
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
76
|
+
publish_dir: ./docs
|
|
77
|
+
publish_branch: gh-pages
|
|
78
|
+
|
|
79
|
+
# Configure GitHub Pages to serve from the gh-pages branch (root /).
|
|
80
|
+
# This uses the GitHub REST API with GITHUB_TOKEN (permission: 'pages: write').
|
|
81
|
+
# It is idempotent — safe to run on every render (201=create, 409/422=exists, update).
|
|
82
|
+
# GITHUB_TOKEN is ephemeral (created per-run, expires at run end), scoped only to
|
|
83
|
+
# this repository, and never logged. GitHub accepts it because the token is issued
|
|
84
|
+
# by GitHub itself and this workflow declares 'pages: write' permission.
|
|
85
|
+
# continue-on-error: the API call may return a conflict on the very first run while
|
|
86
|
+
# GitHub is still processing the new gh-pages branch — this is non-fatal.
|
|
87
|
+
- name: Configure GitHub Pages source
|
|
88
|
+
continue-on-error: true
|
|
89
|
+
run: |
|
|
90
|
+
TOKEN="${{ secrets.GITHUB_TOKEN }}"
|
|
91
|
+
REPO="${{ github.repository }}"
|
|
92
|
+
|
|
93
|
+
HTTP_CODE=$(curl -s -o response.json -w "%{http_code}" \
|
|
94
|
+
-X POST \
|
|
95
|
+
-H "Authorization: token $TOKEN" \
|
|
96
|
+
-H "Accept: application/vnd.github+json" \
|
|
97
|
+
"https://api.github.com/repos/$REPO/pages" \
|
|
98
|
+
-d '{"source":{"branch":"gh-pages","path":"/"}}')
|
|
99
|
+
|
|
100
|
+
# 201 = created; 409/422 = already exists, update instead
|
|
101
|
+
if [ "$HTTP_CODE" -eq 409 ] || [ "$HTTP_CODE" -eq 422 ]; then
|
|
102
|
+
curl -s -o /dev/null \
|
|
103
|
+
-X PUT \
|
|
104
|
+
-H "Authorization: token $TOKEN" \
|
|
105
|
+
-H "Accept: application/vnd.github+json" \
|
|
106
|
+
"https://api.github.com/repos/$REPO/pages" \
|
|
107
|
+
-d '{"source":{"branch":"gh-pages","path":"/"}}'
|
|
108
|
+
fi
|
|
109
|
+
echo "GitHub Pages source set to gh-pages branch"
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
name: Set GitHub Pages and Homepage
|
|
2
2
|
|
|
3
|
+
# One-time setup workflow: run this AFTER the first successful
|
|
4
|
+
# render-and-deploy run, which creates the gh-pages branch.
|
|
5
|
+
# It configures GitHub Pages to serve from the gh-pages branch (root /)
|
|
6
|
+
# and sets the repository homepage URL.
|
|
7
|
+
|
|
3
8
|
on:
|
|
4
9
|
workflow_dispatch:
|
|
5
10
|
|
|
@@ -7,93 +12,90 @@ jobs:
|
|
|
7
12
|
configure-pages-and-homepage:
|
|
8
13
|
runs-on: ubuntu-latest
|
|
9
14
|
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
pages: write # To configure Pages settings
|
|
15
|
+
contents: read
|
|
12
16
|
steps:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-H "Authorization: token ${{ secrets.MY_PAT }}" \
|
|
18
|
-
-H "Accept: application/vnd.github+json" \
|
|
19
|
-
https://api.github.com/repos/${{ github.repository }}/branches/gh-pages)
|
|
20
|
-
if [ "$RESPONSE" -eq 200 ]; then
|
|
21
|
-
echo "gh-pages branch exists"
|
|
22
|
-
echo "BRANCH_EXISTS=true" >> $GITHUB_ENV
|
|
23
|
-
elif [ "$RESPONSE" -eq 404 ]; then
|
|
24
|
-
echo "Error: gh-pages branch does not exist in ${{ github.repository }}"
|
|
25
|
-
exit 1
|
|
26
|
-
else
|
|
27
|
-
echo "Unexpected response code: $RESPONSE"
|
|
28
|
-
exit 1
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
- name: Set GitHub Pages to gh-pages
|
|
32
|
-
if: env.BRANCH_EXISTS == 'true'
|
|
17
|
+
# Configure Pages to serve from the gh-pages branch (root /).
|
|
18
|
+
# POST creates the resource; a 409 means it already exists, so we PUT
|
|
19
|
+
# to update the source to the gh-pages branch.
|
|
20
|
+
- name: Enable GitHub Pages (gh-pages branch source)
|
|
33
21
|
env:
|
|
34
22
|
PAT: ${{ secrets.MY_PAT }}
|
|
35
23
|
run: |
|
|
36
|
-
|
|
24
|
+
HTTP_CODE=$(curl -s -L \
|
|
37
25
|
-X POST \
|
|
38
26
|
-H "Authorization: token $PAT" \
|
|
39
27
|
-H "Accept: application/vnd.github+json" \
|
|
40
28
|
https://api.github.com/repos/${{ github.repository }}/pages \
|
|
41
29
|
-d '{"source":{"branch":"gh-pages","path":"/"}}' \
|
|
42
|
-
-w "%{http_code}" -o response.json)
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
-w "%{http_code}" -o response.json | tail -n1)
|
|
31
|
+
|
|
32
|
+
if [ "$HTTP_CODE" -eq 201 ] || [ "$HTTP_CODE" -eq 200 ]; then
|
|
33
|
+
echo "GitHub Pages enabled with gh-pages branch as source"
|
|
34
|
+
elif [ "$HTTP_CODE" -eq 409 ]; then
|
|
35
|
+
echo "Pages already exists — updating source to gh-pages branch..."
|
|
36
|
+
HTTP_CODE2=$(curl -s -L \
|
|
37
|
+
-X PUT \
|
|
38
|
+
-H "Authorization: token $PAT" \
|
|
39
|
+
-H "Accept: application/vnd.github+json" \
|
|
40
|
+
https://api.github.com/repos/${{ github.repository }}/pages \
|
|
41
|
+
-d '{"source":{"branch":"gh-pages","path":"/"}}' \
|
|
42
|
+
-w "%{http_code}" -o response2.json | tail -n1)
|
|
43
|
+
if [ "$HTTP_CODE2" -eq 200 ] || [ "$HTTP_CODE2" -eq 204 ]; then
|
|
44
|
+
echo "GitHub Pages source updated to gh-pages branch"
|
|
45
|
+
else
|
|
46
|
+
echo "Failed to update Pages: $HTTP_CODE2"
|
|
47
|
+
cat response2.json
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
45
50
|
else
|
|
46
|
-
echo "Failed to
|
|
51
|
+
echo "Failed to configure Pages: $HTTP_CODE"
|
|
47
52
|
cat response.json
|
|
48
53
|
exit 1
|
|
49
54
|
fi
|
|
50
55
|
|
|
56
|
+
# Set the repository homepage field to the expected GitHub Pages URL so
|
|
57
|
+
# it appears prominently on the repository landing page.
|
|
51
58
|
- name: Set repository homepage to GitHub Pages URL
|
|
52
|
-
if: env.BRANCH_EXISTS == 'true'
|
|
53
59
|
env:
|
|
54
60
|
PAT: ${{ secrets.MY_PAT }}
|
|
55
61
|
run: |
|
|
56
|
-
# Construct the expected GitHub Pages URL
|
|
57
62
|
REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
|
|
58
63
|
OWNER=$(echo "${{ github.repository }}" | cut -d'/' -f1)
|
|
59
64
|
PAGES_URL="https://${OWNER}.github.io/${REPO_NAME}"
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
RESPONSE=$(curl -s -L \
|
|
66
|
+
HTTP_CODE=$(curl -s -L \
|
|
63
67
|
-X PATCH \
|
|
64
68
|
-H "Authorization: token $PAT" \
|
|
65
69
|
-H "Accept: application/vnd.github+json" \
|
|
66
70
|
https://api.github.com/repos/${{ github.repository }} \
|
|
67
71
|
-d "{\"homepage\":\"${PAGES_URL}\"}" \
|
|
68
|
-
-w "%{http_code}" -o response.json)
|
|
72
|
+
-w "%{http_code}" -o response.json | tail -n1)
|
|
69
73
|
|
|
70
|
-
if [ "$
|
|
71
|
-
echo "Repository homepage set to $PAGES_URL
|
|
74
|
+
if [ "$HTTP_CODE" -eq 200 ]; then
|
|
75
|
+
echo "Repository homepage set to $PAGES_URL"
|
|
72
76
|
else
|
|
73
|
-
echo "Failed to set homepage: $
|
|
77
|
+
echo "Failed to set homepage: $HTTP_CODE"
|
|
74
78
|
cat response.json
|
|
75
79
|
exit 1
|
|
76
80
|
fi
|
|
77
81
|
|
|
82
|
+
# Verify the homepage was written correctly.
|
|
78
83
|
- name: Verify homepage matches GitHub Pages URL
|
|
79
|
-
if: env.BRANCH_EXISTS == 'true'
|
|
80
84
|
env:
|
|
81
85
|
PAT: ${{ secrets.MY_PAT }}
|
|
82
86
|
run: |
|
|
83
|
-
# Construct the expected GitHub Pages URL
|
|
84
87
|
REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
|
|
85
88
|
OWNER=$(echo "${{ github.repository }}" | cut -d'/' -f1)
|
|
86
89
|
EXPECTED_URL="https://${OWNER}.github.io/${REPO_NAME}"
|
|
87
90
|
|
|
88
|
-
# Fetch the current homepage from the repo
|
|
89
91
|
CURRENT_HOMEPAGE=$(curl -s -L \
|
|
90
92
|
-H "Authorization: token $PAT" \
|
|
91
93
|
-H "Accept: application/vnd.github+json" \
|
|
92
94
|
https://api.github.com/repos/${{ github.repository }} | jq -r '.homepage')
|
|
93
95
|
|
|
94
96
|
if [ "$CURRENT_HOMEPAGE" = "$EXPECTED_URL" ]; then
|
|
95
|
-
echo "Verified:
|
|
97
|
+
echo "Verified: homepage is $EXPECTED_URL"
|
|
96
98
|
else
|
|
97
|
-
echo "Error:
|
|
99
|
+
echo "Error: homepage ($CURRENT_HOMEPAGE) does not match $EXPECTED_URL"
|
|
98
100
|
exit 1
|
|
99
101
|
fi
|