@@ -11,118 +11,118 @@ permissions:
1111 contents : write
1212
1313jobs :
14- publish :
15- runs-on : ubuntu-latest
16- env :
17- TZ : Europe/Prague
18- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
19- # Set to 'true' to allow the workflow to push updates to the registry branch
20- PUSH_REGISTRY : ' true'
21- # Set to 'true' to override whole branch with generated content (keeps just one commit history)
22- OVERRIDE_BRANCH : ' false'
23- # Default registry repo URL; derived from the current repository
24- REGISTRY_GIT_URL : https://github.com/${{ github.repository }}.git
25- steps :
26- - name : Checkout repository
27- uses : actions/checkout@v5
28- with :
29- fetch-depth : 0 # Full history for tags
30-
31- - name : Set up Node.js
32- uses : actions/setup-node@v3
33- with :
34- node-version : ' 24.x'
35-
36- - name : Setup pnpm
37- uses : pnpm/action-setup@v3
38- with :
39- version : latest
40-
41- - name : Get pnpm store directory
42- id : pnpm-cache
43- shell : bash
44- run : |
45- echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
46-
47- - name : Setup pnpm cache
48- uses : actions/cache@v4
49- with :
50- path : ${{ steps.pnpm-cache.outputs.STORE_PATH }}
51- key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52- restore-keys : |
53- ${{ runner.os }}-pnpm-store-
54-
55- - name : Checkout Jaculus-tools
56- run : |
57- git clone https://github.com/jaculus-org/Jaculus-tools.git --branch feat/lib ../Jaculus-tools
58- cd ../Jaculus-tools
59- pnpm install
60- pnpm build
61-
62- - name : Clone and Build Registry Tool
63- run : |
64- git clone https://github.com/jaculus-org/Jaculus-registry.git ../jaculus-registry
65- cd ../jaculus-registry
66- pnpm install
67- # Link local jaculus packages (if any) from the previously cloned Jaculus-tools
68- for pkg in ../Jaculus-tools/packages/*; do
69- if [ -f "$pkg/package.json" ]; then
70- echo "Linking local package: $pkg"
71- pnpm link "$pkg" || true
72- fi
73- done
74- pnpm build || true
75- pnpm link || true
76-
77- - name : Clone target registry repo (dist)
78- run : |
79- git clone $REGISTRY_GIT_URL ../jaculus-registry-dist
80- cd ../jaculus-registry-dist
81- git fetch --all
82- git checkout registry || git checkout -b registry
83- cd -
84-
85- - name : Prepare filtered registry source and Generate registry
86- run : |
87- # Use the previously cloned dist repo as the destination
88- jaculus-registry generate ./ ../jaculus-registry-dist
89-
90- - name : Copy dist to accessible location
91- run : |
92- mkdir -p jaculus-registry-artifact
93- cp -r ../jaculus-registry-dist/* jaculus-registry-artifact/
94-
95- - name : Upload registry dist artifact
96- uses : actions/upload-artifact@v4
97- with :
98- name : registry-dist
99- path : jaculus-registry-artifact/
100-
101- - name : Push registry branch (optional)
102- if : ${{ env.PUSH_REGISTRY == 'true' && github.event_name == 'push' }}
103- run : |
104- set -euo pipefail
105- cd ../jaculus-registry-dist
106-
107- # Configure git (email is optional - GitHub Actions provides defaults)
108- git config user.name "github-actions[bot]"
109- git config user.email "github-actions[bot]@users.noreply.github.com"
110-
111- # Set up authentication
112- git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
113- git checkout registry || git checkout -b registry
114-
115- # If OVERRIDE_BRANCH is enabled, reset to single commit, otherwise just add commit
116- if [ "${{ env.OVERRIDE_BRANCH }}" = "true" ]; then
117- # Remove all history and keep only current state
118- git add -A
119- git commit --allow-empty -m "Update registry via GitHub Actions (${GITHUB_SHA})"
120- git reset --soft $(git rev-list --max-parents=0 HEAD)
121- git commit --amend -m "Registry build from $(git rev-parse --short HEAD:../Jaculus-libraries/.git/HEAD || echo 'main')"
122- git push --force origin registry
123- else
124- # Regular commit and push
125- git add -A
126- git commit -m "Update registry via GitHub Actions (${GITHUB_SHA})" || echo "No changes to commit"
127- git push origin registry
128- fi
14+ publish :
15+ runs-on : ubuntu-latest
16+ env :
17+ TZ : Europe/Prague
18+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
19+ # Set to 'true' to allow the workflow to push updates to the registry branch
20+ PUSH_REGISTRY : " true"
21+ # Set to 'true' to override whole branch with generated content (keeps just one commit history)
22+ OVERRIDE_BRANCH : " false"
23+ # Default registry repo URL; derived from the current repository
24+ REGISTRY_GIT_URL : https://github.com/${{ github.repository }}.git
25+ steps :
26+ - name : Checkout repository
27+ uses : actions/checkout@v5
28+ with :
29+ fetch-depth : 0 # Full history for tags
30+
31+ - name : Set up Node.js
32+ uses : actions/setup-node@v3
33+ with :
34+ node-version : " 24.x"
35+
36+ - name : Setup pnpm
37+ uses : pnpm/action-setup@v3
38+ with :
39+ version : latest
40+
41+ - name : Get pnpm store directory
42+ id : pnpm-cache
43+ shell : bash
44+ run : |
45+ echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
46+
47+ - name : Setup pnpm cache
48+ uses : actions/cache@v4
49+ with :
50+ path : ${{ steps.pnpm-cache.outputs.STORE_PATH }}
51+ key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52+ restore-keys : |
53+ ${{ runner.os }}-pnpm-store-
54+
55+ - name : Checkout Jaculus-tools
56+ run : |
57+ git clone https://github.com/jaculus-org/Jaculus-tools.git --branch feat/lib ../Jaculus-tools
58+ cd ../Jaculus-tools
59+ pnpm install
60+ pnpm build
61+
62+ - name : Clone and Build Registry Tool
63+ run : |
64+ git clone https://github.com/jaculus-org/Jaculus-registry.git ../jaculus-registry
65+ cd ../jaculus-registry
66+ pnpm install
67+ # Link local jaculus packages (if any) from the previously cloned Jaculus-tools
68+ for pkg in ../Jaculus-tools/packages/*; do
69+ if [ -f "$pkg/package.json" ]; then
70+ echo "Linking local package: $pkg"
71+ pnpm link "$pkg" || true
72+ fi
73+ done
74+ pnpm build || true
75+ pnpm link || true
76+
77+ - name : Clone target registry repo (dist)
78+ run : |
79+ git clone $REGISTRY_GIT_URL ../jaculus-registry-dist
80+ cd ../jaculus-registry-dist
81+ git fetch --all
82+ git checkout registry || git checkout -b registry
83+ cd -
84+
85+ - name : Prepare filtered registry source and Generate registry
86+ run : |
87+ # Use the previously cloned dist repo as the destination
88+ jaculus-registry generate ./ ../jaculus-registry-dist
89+
90+ - name : Copy dist to accessible location
91+ run : |
92+ mkdir -p jaculus-registry-artifact
93+ cp -r ../jaculus-registry-dist/* jaculus-registry-artifact/
94+
95+ - name : Upload registry dist artifact
96+ uses : actions/upload-artifact@v4
97+ with :
98+ name : registry-dist
99+ path : jaculus-registry-artifact/
100+
101+ - name : Push registry branch (optional)
102+ if : ${{ env.PUSH_REGISTRY == 'true' && github.event_name == 'push' }}
103+ run : |
104+ set -euo pipefail
105+ cd ../jaculus-registry-dist
106+
107+ # Configure git (email is optional - GitHub Actions provides defaults)
108+ git config user.name "github-actions[bot]"
109+ git config user.email "github-actions[bot]@users.noreply.github.com"
110+
111+ # Set up authentication
112+ git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
113+ git checkout registry || git checkout -b registry
114+
115+ # If OVERRIDE_BRANCH is enabled, reset to single commit, otherwise just add commit
116+ if [ "${{ env.OVERRIDE_BRANCH }}" = "true" ]; then
117+ # Remove all history and keep only current state
118+ git add -A
119+ git commit --allow-empty -m "Update registry via GitHub Actions (${GITHUB_SHA})"
120+ git reset --soft $(git rev-list --max-parents=0 HEAD)
121+ git commit --amend -m "Registry build from $(git rev-parse --short HEAD:../Jaculus-libraries/.git/HEAD || echo 'main')"
122+ git push --force origin registry
123+ else
124+ # Regular commit and push
125+ git add -A
126+ git commit -m "Update registry via GitHub Actions (${GITHUB_SHA})" || echo "No changes to commit"
127+ git push origin registry
128+ fi
0 commit comments