spec-up-t 1.1.17 → 1.1.20

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.17",
3
+ "version": "1.1.20",
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": {
@@ -0,0 +1,99 @@
1
+ name: Set GitHub Pages and Homepage
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ configure-pages-and-homepage:
8
+ runs-on: ubuntu-latest
9
+ permissions:
10
+ contents: read # To check branches
11
+ pages: write # To configure Pages settings
12
+ steps:
13
+ - name: Check if gh-pages branch exists
14
+ id: check-branch
15
+ run: |
16
+ RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" \
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'
33
+ env:
34
+ PAT: ${{ secrets.MY_PAT }}
35
+ run: |
36
+ RESPONSE=$(curl -s -L \
37
+ -X POST \
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" \
91
+ -H "Accept: application/vnd.github+json" \
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