spec-up-t 1.1.18 → 1.1.21

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-up-t",
3
- "version": "1.1.18",
3
+ "version": "1.1.21",
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": {
@@ -7,32 +7,31 @@ on:
7
7
  description: 'Select the script to run'
8
8
  type: choice
9
9
  required: true
10
- default: 'render'
10
+ default: 'Render specification'
11
11
  options:
12
- - edit
13
- - render
14
- - dev
15
- - collectExternalReferencesCache
16
- - collectExternalReferencesNoCache
17
- - topdf
18
- - freeze
19
- - references
20
- - help
21
- - menu
22
- - addremovexrefsource
23
- - configure
24
- - custom-update
12
+ # - Edit specification
13
+ - Render specification
14
+ # - Develop specification
15
+ - Collect external references (cached)
16
+ - Collect external references (no cache)
17
+ - Convert to PDF
18
+ - Freeze specification
19
+ - List references
20
+ # - Show help
21
+ # - Add/remove xref source
22
+ # - Configure specification
23
+ - Custom update
25
24
 
26
25
  jobs:
27
26
  build-and-deploy-spec:
28
27
  runs-on: ubuntu-latest
29
28
  permissions:
30
- contents: write
29
+ contents: write # Needed for pushing changes
31
30
  steps:
32
31
  - name: Checkout 🛎️
33
32
  uses: actions/checkout@v4
34
33
  with:
35
- persist-credentials: false
34
+ persist-credentials: false # We’ll use MY_PAT for push
36
35
 
37
36
  - name: Set up Node.js
38
37
  uses: actions/setup-node@v4
@@ -60,42 +59,47 @@ jobs:
60
59
  env:
61
60
  MY_PAT: ${{ secrets.MY_PAT }} # Make the secret available as an env var
62
61
  run: |
63
- case ${{ github.event.inputs.script }} in
64
- "edit")
62
+ case "${{ github.event.inputs.script }}" in
63
+ "Edit specification")
65
64
  node -e "require('spec-up-t')()"
66
65
  ;;
67
- "render")
66
+ "Render specification")
68
67
  node --no-warnings -e "require('spec-up-t/index.js')({ nowatch: true })"
69
68
  ;;
70
- "dev")
69
+ "Develop specification")
71
70
  node -e "require('spec-up-t')({ dev: true })"
72
71
  ;;
73
- "collectExternalReferencesCache")
72
+ "Collect external references (cached)")
74
73
  node --no-warnings -e "require('spec-up-t/src/collect-external-references.js').collectExternalReferences({cache: true})"
75
74
  ;;
76
- "collectExternalReferencesNoCache")
75
+ "Collect external references (no cache)")
77
76
  node --no-warnings -e "require('spec-up-t/src/collect-external-references.js').collectExternalReferences({cache: false, pat: process.env.MY_PAT})"
78
77
  ;;
79
- "topdf")
78
+ "Convert to PDF")
80
79
  node -e "require('spec-up-t/src/create-pdf.js')"
81
80
  ;;
82
- "freeze")
81
+ "Freeze specification")
83
82
  node -e "require('spec-up-t/src/freeze.js')"
84
83
  ;;
85
- "references")
84
+ "List references")
86
85
  node -e "require('spec-up-t/src/references.js')"
87
86
  ;;
88
- "help")
87
+ "Show help")
89
88
  cat ./node_modules/spec-up-t/src/install-from-boilerplate/help.txt || echo "Help file not found"
90
89
  ;;
91
- "addremovexrefsource")
90
+ "Add/remove xref source")
92
91
  node --no-warnings -e "require('spec-up-t/src/add-remove-xref-source.js')"
93
92
  ;;
94
- "configure")
93
+ "Configure specification")
95
94
  node --no-warnings -e "require('spec-up-t/src/configure.js')"
96
95
  ;;
97
- "custom-update")
96
+ "Custom update")
98
97
  npm update && node -e "require('spec-up-t/src/install-from-boilerplate/custom-update.js')"
98
+ git config --global user.email "actions@github.com"
99
+ git config --global user.name "GitHub Actions"
100
+ git add .
101
+ git commit -m "Custom update: Copy files from spec-up-t" || echo "No changes to commit"
102
+ git push https://x-access-token:${{ secrets.MY_PAT }}@github.com/${{ github.repository }}.git HEAD:main
99
103
  ;;
100
104
  *)
101
105
  echo "Unknown script: ${{ github.event.inputs.script }}"
@@ -104,8 +108,8 @@ jobs:
104
108
  esac
105
109
 
106
110
  - name: Deploy to GitHub Pages
107
- if: success() && github.event.inputs.script != 'help'
108
- uses: peaceiris/actions-gh-pages@v3.7.3
111
+ if: success() && github.event.inputs.script != 'Show help'
112
+ uses: actions/upload-artifact@v4
109
113
  with:
110
114
  github_token: ${{ secrets.GITHUB_TOKEN }}
111
115
  publish_dir: ${{ env.OUTPUT_PATH }}
@@ -1,40 +1,27 @@
1
- name: Set GitHub Pages
1
+ name: Set GitHub Pages and Homepage
2
2
 
3
3
  on:
4
4
  workflow_dispatch:
5
- inputs:
6
- username:
7
- description: 'Your GitHub username (optional, defaults to repository owner)'
8
- required: false
9
5
 
10
6
  jobs:
11
- configure-pages:
7
+ configure-pages-and-homepage:
12
8
  runs-on: ubuntu-latest
13
9
  permissions:
14
10
  contents: read # To check branches
15
11
  pages: write # To configure Pages settings
16
12
  steps:
17
- - name: Determine repository owner
18
- id: get-owner
19
- run: |
20
- OWNER="${{ github.event.inputs.username }}"
21
- if [ -z "$OWNER" ]; then
22
- OWNER="${{ github.repository_owner }}"
23
- fi
24
- echo "OWNER=$OWNER" >> $GITHUB_ENV
25
-
26
13
  - name: Check if gh-pages branch exists
27
14
  id: check-branch
28
15
  run: |
29
16
  RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
30
- -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
17
+ -H "Authorization: token ${{ secrets.MY_PAT }}" \
31
18
  -H "Accept: application/vnd.github+json" \
32
- https://api.github.com/repos/${{ env.OWNER }}/${{ github.repository }}/branches/gh-pages)
19
+ https://api.github.com/repos/${{ github.repository }}/branches/gh-pages)
33
20
  if [ "$RESPONSE" -eq 200 ]; then
34
21
  echo "gh-pages branch exists"
35
22
  echo "BRANCH_EXISTS=true" >> $GITHUB_ENV
36
23
  elif [ "$RESPONSE" -eq 404 ]; then
37
- echo "Error: gh-pages branch does not exist in ${{ env.OWNER }}/${{ github.repository }}"
24
+ echo "Error: gh-pages branch does not exist in ${{ github.repository }}"
38
25
  exit 1
39
26
  else
40
27
  echo "Unexpected response code: $RESPONSE"
@@ -43,11 +30,70 @@ jobs:
43
30
 
44
31
  - name: Set GitHub Pages to gh-pages
45
32
  if: env.BRANCH_EXISTS == 'true'
33
+ env:
34
+ PAT: ${{ secrets.MY_PAT }}
46
35
  run: |
47
- curl -L \
36
+ RESPONSE=$(curl -s -L \
48
37
  -X POST \
49
- -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
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 response.json)
43
+ if [ "$RESPONSE" -eq 201 ] || [ "$RESPONSE" -eq 200 ]; then
44
+ echo "GitHub Pages set to gh-pages branch for ${{ github.repository }}"
45
+ else
46
+ echo "Failed to set GitHub Pages: $RESPONSE"
47
+ cat response.json
48
+ exit 1
49
+ fi
50
+
51
+ - name: Set repository homepage to GitHub Pages URL
52
+ if: env.BRANCH_EXISTS == 'true'
53
+ env:
54
+ PAT: ${{ secrets.MY_PAT }}
55
+ run: |
56
+ # Construct the expected GitHub Pages URL
57
+ REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
58
+ OWNER=$(echo "${{ github.repository }}" | cut -d'/' -f1)
59
+ PAGES_URL="https://${OWNER}.github.io/${REPO_NAME}"
60
+
61
+ # Set the homepage via API
62
+ RESPONSE=$(curl -s -L \
63
+ -X PATCH \
64
+ -H "Authorization: token $PAT" \
65
+ -H "Accept: application/vnd.github+json" \
66
+ https://api.github.com/repos/${{ github.repository }} \
67
+ -d "{\"homepage\":\"${PAGES_URL}\"}" \
68
+ -w "%{http_code}" -o response.json)
69
+
70
+ if [ "$RESPONSE" -eq 200 ]; then
71
+ echo "Repository homepage set to $PAGES_URL for ${{ github.repository }}"
72
+ else
73
+ echo "Failed to set homepage: $RESPONSE"
74
+ cat response.json
75
+ exit 1
76
+ fi
77
+
78
+ - name: Verify homepage matches GitHub Pages URL
79
+ if: env.BRANCH_EXISTS == 'true'
80
+ env:
81
+ PAT: ${{ secrets.MY_PAT }}
82
+ run: |
83
+ # Construct the expected GitHub Pages URL
84
+ REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
85
+ OWNER=$(echo "${{ github.repository }}" | cut -d'/' -f1)
86
+ EXPECTED_URL="https://${OWNER}.github.io/${REPO_NAME}"
87
+
88
+ # Fetch the current homepage from the repo
89
+ CURRENT_HOMEPAGE=$(curl -s -L \
90
+ -H "Authorization: token $PAT" \
50
91
  -H "Accept: application/vnd.github+json" \
51
- https://api.github.com/repos/${{ env.OWNER }}/${{ github.repository }}/pages \
52
- -d '{"source":{"branch":"gh-pages","path":"/"}}'
53
- echo "GitHub Pages set to gh-pages branch for ${{ env.OWNER }}/${{ github.repository }}"
92
+ https://api.github.com/repos/${{ github.repository }} | jq -r '.homepage')
93
+
94
+ if [ "$CURRENT_HOMEPAGE" = "$EXPECTED_URL" ]; then
95
+ echo "Verified: Homepage is set to GitHub Pages URL ($EXPECTED_URL)"
96
+ else
97
+ echo "Error: Homepage ($CURRENT_HOMEPAGE) does not match expected GitHub Pages URL ($EXPECTED_URL)"
98
+ exit 1
99
+ fi
@@ -1,3 +1,5 @@
1
1
  # Documentation
2
2
 
3
- Read more about Spec-Up-T in the [documentation](https://trustoverip.github.io/spec-up-t-website/).
3
+ Read more about Spec-Up-T in the [documentation](https://trustoverip.github.io/spec-up-t-website/).
4
+
5
+ Written: 2025-02-27T15:38