|
1 | | -name: Sync engine to schema-forge |
| 1 | +name: Sync schema-forge |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
15 | 15 | jobs: |
16 | 16 | sync: |
17 | 17 | runs-on: ubuntu-latest |
18 | | - |
19 | 18 | steps: |
20 | 19 | - name: Checkout Iris |
21 | 20 | uses: actions/checkout@v4 |
22 | 21 | with: |
23 | | - fetch-depth: 2 |
24 | | - |
25 | | - - name: Check for engine changes |
26 | | - id: changes |
27 | | - run: | |
28 | | - ENGINE_PATHS=( |
29 | | - "src/lib/schema" |
30 | | - "src/lib/types/interpreterTypes.ts" |
31 | | - "src/lib/types/schemaTypes.ts" |
32 | | - "src/lib/transforms" |
33 | | - "src/lib/utils/schema" |
34 | | - "src/lib/utils/csv" |
35 | | - "src/lib/utils/xml" |
36 | | - ) |
37 | | -
|
38 | | - CHANGED=false |
39 | | - for path in "${ENGINE_PATHS[@]}"; do |
40 | | - if git diff --name-only HEAD~1 HEAD -- "$path" | grep -q .; then |
41 | | - CHANGED=true |
42 | | - break |
43 | | - fi |
44 | | - done |
45 | | -
|
46 | | - echo "changed=$CHANGED" >> "$GITHUB_OUTPUT" |
47 | | -
|
48 | | - - name: Clone schema-forge |
49 | | - if: steps.changes.outputs.changed == 'true' |
50 | | - run: | |
51 | | - git clone https://x-access-token:${{ secrets.SCHEMA_FORGE_PAT }}@github.com/JasonWarrenUK/schema-forge.git /tmp/schema-forge |
52 | | -
|
53 | | - - name: Sync engine files |
54 | | - if: steps.changes.outputs.changed == 'true' |
55 | | - run: | |
56 | | - TARGET=/tmp/schema-forge/src |
57 | | -
|
58 | | - # Clear previous engine content (full replace, not merge) |
59 | | - rm -rf "$TARGET" |
60 | | - mkdir -p "$TARGET" |
61 | | -
|
62 | | - # Copy engine modules preserving structure |
63 | | - cp -r src/lib/schema "$TARGET/schema" |
64 | | - cp -r src/lib/transforms "$TARGET/transforms" |
65 | | - cp -r src/lib/utils/schema "$TARGET/utils/schema" |
66 | | - cp -r src/lib/utils/csv "$TARGET/utils/csv" |
67 | | - cp -r src/lib/utils/xml "$TARGET/utils/xml" |
68 | | -
|
69 | | - mkdir -p "$TARGET/types" |
70 | | - cp src/lib/types/interpreterTypes.ts "$TARGET/types/" |
71 | | - cp src/lib/types/schemaTypes.ts "$TARGET/types/" |
| 22 | + fetch-depth: 0 |
72 | 23 |
|
73 | | - - name: Commit and push |
74 | | - if: steps.changes.outputs.changed == 'true' |
75 | | - working-directory: /tmp/schema-forge |
| 24 | + - name: Stage engine files |
76 | 25 | run: | |
77 | | - git config user.name "iris-sync[bot]" |
78 | | - git config user.email "iris-sync[bot]@users.noreply.github.com" |
79 | | -
|
80 | | - git add -A |
81 | | - if git diff --cached --quiet; then |
82 | | - echo "No changes to commit" |
83 | | - exit 0 |
84 | | - fi |
85 | | -
|
86 | | - COMMIT_SHA="${{ github.sha }}" |
87 | | - git commit -m "sync: update engine from iris@${COMMIT_SHA:0:7} |
88 | | -
|
89 | | - Source: ${{ github.server_url }}/${{ github.repository }}/commit/${COMMIT_SHA}" |
90 | | - git push |
| 26 | + mkdir -p /tmp/engine-stage/schema |
| 27 | + mkdir -p /tmp/engine-stage/transforms |
| 28 | + mkdir -p /tmp/engine-stage/types |
| 29 | + mkdir -p /tmp/engine-stage/utils/schema |
| 30 | + mkdir -p /tmp/engine-stage/utils/csv |
| 31 | + mkdir -p /tmp/engine-stage/utils/xml |
| 32 | +
|
| 33 | + cp -r src/lib/schema/. /tmp/engine-stage/schema/ |
| 34 | + cp -r src/lib/transforms/. /tmp/engine-stage/transforms/ |
| 35 | + cp -r src/lib/utils/schema/. /tmp/engine-stage/utils/schema/ |
| 36 | + cp -r src/lib/utils/csv/. /tmp/engine-stage/utils/csv/ |
| 37 | + cp -r src/lib/utils/xml/. /tmp/engine-stage/utils/xml/ |
| 38 | + cp src/lib/types/interpreterTypes.ts /tmp/engine-stage/types/ |
| 39 | + cp src/lib/types/schemaTypes.ts /tmp/engine-stage/types/ |
| 40 | +
|
| 41 | + - name: Push engine directory to schema-forge repo |
| 42 | + uses: peaceiris/actions-gh-pages@v4 |
| 43 | + with: |
| 44 | + personal_token: ${{ secrets.SCHEMA_FORGE_PAT }} |
| 45 | + external_repository: JasonWarrenUK/schema-forge |
| 46 | + publish_dir: /tmp/engine-stage |
| 47 | + publish_branch: main |
| 48 | + destination_dir: src |
| 49 | + commit_message: "sync: update from iris@${{ github.sha }}" |
| 50 | + enable_jekyll: true |
0 commit comments