-
Notifications
You must be signed in to change notification settings - Fork 62
2862 lines (2597 loc) · 116 KB
/
Copy pathpublish.yaml
File metadata and controls
2862 lines (2597 loc) · 116 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Publish Release
# Action-first html-to-markdown release pipeline.
#
# Orchestrates 11 alef language targets:
# crates · cli · python · node · typescript · wasm · ruby · php · go · c-ffi
# java · csharp · elixir · homebrew
#
# Mirrors Xberg's publish.yaml composition: every registry interaction,
# every multi-platform build, and every release-asset upload routes through
# a shared xberg-io/actions composite. Inline bash is reserved for
# repo-quirky orchestration only (homebrew bottle assembly, Node platform
# package staging, NIF artifact packaging, multi-formula brew flow).
on:
workflow_dispatch:
inputs:
tag:
description: "Release tag to build (e.g., v2.6.0)"
required: false
type: string
ref:
description: "Git ref (branch, tag, or commit) to build; defaults to the tag"
required: false
type: string
targets:
description: "Comma-separated list of release targets, or 'all'"
required: false
type: string
default: "all"
dry_run:
description: "Prepare artifacts without publishing"
required: false
type: boolean
default: false
republish:
description: "Delete and re-create the tag on current HEAD before publishing"
required: false
type: boolean
default: false
force_republish:
description: "Force republish targets whose registry version already exists"
required: false
type: boolean
default: false
release:
types: [published]
repository_dispatch:
types: [publish-release]
permissions:
contents: read
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ (github.event_name == 'workflow_dispatch' && (github.event.inputs.ref || github.event.inputs.tag)) || github.ref || github.run_id }}
cancel-in-progress: false
jobs:
prepare:
name: Prepare metadata
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.meta.outputs.tag }}
version: ${{ steps.meta.outputs.version }}
ref: ${{ steps.meta.outputs.ref }}
checkout_ref: ${{ steps.meta.outputs.checkout_ref }}
target_sha: ${{ steps.meta.outputs.target_sha }}
matrix_ref: ${{ steps.meta.outputs.matrix_ref }}
is_tag: ${{ steps.meta.outputs.is_tag }}
is_prerelease: ${{ steps.meta.outputs.is_prerelease }}
npm_tag: ${{ steps.meta.outputs.npm_tag }}
dry_run: ${{ steps.meta.outputs.dry_run }}
force_republish: ${{ steps.meta.outputs.force_republish }}
release_targets: ${{ steps.meta.outputs.release_targets }}
release_any: ${{ steps.meta.outputs.release_any }}
release_python: ${{ steps.meta.outputs.release_python }}
release_node: ${{ steps.meta.outputs.release_node }}
release_ruby: ${{ steps.meta.outputs.release_ruby }}
release_cli: ${{ steps.meta.outputs.release_cli }}
release_crates: ${{ steps.meta.outputs.release_crates }}
release_homebrew: ${{ steps.meta.outputs.release_homebrew }}
release_java: ${{ steps.meta.outputs.release_java }}
release_csharp: ${{ steps.meta.outputs.release_csharp }}
release_go: ${{ steps.meta.outputs.release_go }}
release_wasm: ${{ steps.meta.outputs.release_wasm }}
release_php: ${{ steps.meta.outputs.release_php }}
release_elixir: ${{ steps.meta.outputs.release_elixir }}
release_c_ffi: ${{ steps.meta.outputs.release_c_ffi }}
release_kotlin: ${{ steps.meta.outputs.release_kotlin }}
release_swift: ${{ steps.meta.outputs.release_swift }}
release_dart: ${{ steps.meta.outputs.release_dart }}
release_zig: ${{ steps.meta.outputs.release_zig }}
steps:
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
owner: xberg-io
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ (inputs.republish == true && (inputs.ref || github.event.repository.default_branch)) || inputs.ref || inputs.tag || github.ref }}
fetch-depth: 0
submodules: recursive
token: ${{ steps.app-token.outputs.token }}
persist-credentials: true
- name: Configure git identity
run: |
git config user.name "xberg-dev-publisher[bot]"
git config user.email "291994444+xberg-dev-publisher[bot]@users.noreply.github.com"
- name: Retag for republish
if: ${{ inputs.republish == true || github.event.client_payload.republish == true }}
uses: xberg-io/actions/retag-for-republish@v1
with:
tag: ${{ inputs.tag || github.event.client_payload.tag }}
token: ${{ steps.app-token.outputs.token }}
- name: Resolve release metadata
id: meta
uses: xberg-io/actions/prepare-release-metadata@v1
- name: Ensure GitHub Release exists for tag
if: ${{ steps.meta.outputs.is_tag == 'true' && steps.meta.outputs.dry_run != 'true' }}
uses: xberg-io/actions/publish-github-release@v1
with:
tag: ${{ steps.meta.outputs.tag }}
target: ${{ steps.meta.outputs.target_sha }}
notes: "Release ${{ steps.meta.outputs.tag }}"
draft: "true"
prerelease: ${{ steps.meta.outputs.is_prerelease }}
token: ${{ steps.app-token.outputs.token }}
validate-versions:
name: Validate language manifest versions
needs: prepare
if: ${{ needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.checkout_ref }}
fetch-depth: 0
submodules: recursive
- name: Validate versions
uses: xberg-io/actions/validate-versions@v1
with:
version: ${{ needs.prepare.outputs.version }}
# ─── Registry existence checks ────────────────────────────────────────
check-pypi:
name: Check PyPI for existing version
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_python == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: pypi
package: html-to-markdown
version: ${{ needs.prepare.outputs.version }}
check-npm:
name: Check npm for existing versions
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_node == 'true' }}
runs-on: ubuntu-latest
outputs:
node_exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: npm
package: "@xberg-io/html-to-markdown"
version: ${{ needs.prepare.outputs.version }}
check-wasm:
name: Check npm for existing WASM package
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_wasm == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: npm
package: "@xberg-io/html-to-markdown-wasm"
version: ${{ needs.prepare.outputs.version }}
check-rubygems:
name: Check RubyGems for existing version
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_ruby == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: rubygems
package: html-to-markdown
version: ${{ needs.prepare.outputs.version }}
check-maven:
name: Check Maven Central for existing version
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_java == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: maven
package: "io.xberg:html-to-markdown"
version: ${{ needs.prepare.outputs.version }}
check-nuget:
name: Check NuGet for existing version
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_csharp == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: nuget
package: XbergIo.HtmlToMarkdown
version: ${{ needs.prepare.outputs.version }}
check-packagist:
name: Check Packagist for existing version
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_php == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: packagist
package: xberg-io/html-to-markdown
version: ${{ needs.prepare.outputs.version }}
check-cratesio:
name: Check crates.io for existing versions
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_crates == 'true' }}
runs-on: ubuntu-latest
outputs:
rs_exists: ${{ steps.check.outputs.exists }}
cli_exists: ${{ steps.check.outputs.cli_exists }}
all_exist: ${{ steps.derive.outputs.all_exist }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: cratesio
package: html-to-markdown-rs
version: ${{ needs.prepare.outputs.version }}
extra-packages: |
cli_exists=html-to-markdown-cli
- id: derive
# Inline: aggregate two check-registry outputs into a single boolean
# the publish-crates job can guard on. No shared action equivalent.
run: |
if [[ "${{ steps.check.outputs.exists }}" == "true" && "${{ steps.check.outputs.cli_exists }}" == "true" ]]; then
echo "all_exist=true" >> "$GITHUB_OUTPUT"
else
echo "all_exist=false" >> "$GITHUB_OUTPUT"
fi
check-hex:
name: Check Hex.pm for existing version
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_elixir == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: hex
package: html_to_markdown
version: ${{ needs.prepare.outputs.version }}
check-homebrew:
name: Check Homebrew tap for formula
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_homebrew == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: homebrew
package: html-to-markdown
version: ${{ needs.prepare.outputs.version }}
tap-repo: xberg-io/homebrew-tap
check-cli:
name: Check GitHub Release for CLI assets
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_cli == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: github-release
package: html-to-markdown
version: ${{ needs.prepare.outputs.version }}
repo: ${{ github.repository }}
tag: ${{ needs.prepare.outputs.tag }}
asset-prefix: cli-
check-go:
name: Check GitHub Release for Go FFI assets
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_go == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: github-release
package: html-to-markdown
version: ${{ needs.prepare.outputs.version }}
repo: ${{ github.repository }}
tag: ${{ needs.prepare.outputs.tag }}
asset-prefix: html-to-markdown-rs-go-
check-c-ffi:
name: Check GitHub Release for C FFI assets
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_c_ffi == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: github-release
package: html-to-markdown
version: ${{ needs.prepare.outputs.version }}
repo: ${{ github.repository }}
tag: ${{ needs.prepare.outputs.tag }}
asset-prefix: html-to-markdown-rs-ffi-
check-elixir-release:
name: Check GitHub Release for Elixir NIF assets
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_elixir == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: github-release
package: html-to-markdown
version: ${{ needs.prepare.outputs.version }}
repo: ${{ github.repository }}
tag: ${{ needs.prepare.outputs.tag }}
asset-prefix: libhtml_to_markdown_nif-
check-maven-kotlin:
name: Check Maven Central for Kotlin Android
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_kotlin == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: maven
package: "io.xberg:html-to-markdown-kotlin"
version: ${{ needs.prepare.outputs.version }}
check-pub:
name: Check pub.dev for Dart package
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_dart == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
uses: xberg-io/actions/check-registry@v1
with:
registry: pub
package: html_to_markdown
version: ${{ needs.prepare.outputs.version }}
dart-natives:
name: Build Dart native library (${{ matrix.rid }})
needs: [prepare, check-pub]
if: ${{ needs.prepare.outputs.release_dart == 'true' && (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && (needs.check-pub.outputs.exists != 'true' || needs.prepare.outputs.force_republish == 'true') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
# rid == the lib/src/native/<rid>/ dir the dart loader (_alefHostRid) searches.
# Dart uses macos-arm64 / linux-x64 style (NOT x86_64/aarch64).
include:
- { os: ubuntu-latest, rid: linux-x64, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-24.04-arm, rid: linux-arm64, target: aarch64-unknown-linux-gnu }
- { os: macos-latest, rid: macos-arm64, target: aarch64-apple-darwin }
- { os: macos-15-intel, rid: macos-x64, target: x86_64-apple-darwin }
- { os: windows-latest, rid: windows-x64, target: x86_64-pc-windows-msvc }
- { os: windows-11-arm, rid: windows-arm64, target: aarch64-pc-windows-msvc }
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.checkout_ref }}
fetch-depth: 0
submodules: recursive
- name: Free disk space
if: runner.os == 'Linux'
uses: xberg-io/actions/free-disk-space-linux@v1
- uses: xberg-io/actions/setup-rust@v1
with:
target: ${{ matrix.target }}
cache-key-prefix: publish-dart-${{ matrix.rid }}
- name: Build and stage Dart native library
# The dart binding ships a dedicated flutter_rust_bridge cdylib
# (html-to-markdown-rs-dart), not the C FFI lib. Build it natively per
# platform and stage under lib/src/native/<rid>/ so the published pub.dev
# package can locate it (the loader falls back to a relative path otherwise,
# which hardened runtimes reject).
shell: bash
run: |
cargo build --release --locked -p html-to-markdown-rs-dart --target ${{ matrix.target }}
mkdir -p "dist/dart-natives/${{ matrix.rid }}"
for src in "target/${{ matrix.target }}/release" "target/release"; do
[[ -d "$src" ]] || continue
find "$src" -maxdepth 1 -type f \( -name 'libhtml_to_markdown_rs_dart.so' -o -name 'libhtml_to_markdown_rs_dart.dylib' -o -name 'html_to_markdown_rs_dart.dll' \) -exec cp {} "dist/dart-natives/${{ matrix.rid }}/" \;
done
ls -la "dist/dart-natives/${{ matrix.rid }}/"
- uses: actions/upload-artifact@v7
with:
name: dart-natives-${{ matrix.rid }}
path: dist/dart-natives
if-no-files-found: error
retention-days: 14
assemble-dart-package:
name: Assemble Dart package artifact
needs: [prepare, check-pub, dart-natives]
if: ${{ needs.prepare.outputs.release_dart == 'true' && (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.dart-natives.result == 'success' && (needs.check-pub.outputs.exists != 'true' || needs.prepare.outputs.force_republish == 'true') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.ref }}
- uses: actions/download-artifact@v8
with:
pattern: dart-natives-*
path: dart-natives-artifacts
merge-multiple: true
- name: Stage prebuilt native libraries into Dart package
# Populate lib/src/native/<rid>/ with the per-platform cdylibs built by
# dart-natives so the published tarball is self-contained. The loader
# (_alefResolveExternalLibrary) resolves these via Isolate.resolvePackageUri.
shell: bash
run: |
for dir in dart-natives-artifacts/*/; do
rid="$(basename "$dir")"
mkdir -p "packages/dart/lib/src/native/${rid}"
cp -r "${dir}." "packages/dart/lib/src/native/${rid}/"
echo "Staged Dart native library for ${rid}:"
ls -la "packages/dart/lib/src/native/${rid}/"
done
- uses: actions/upload-artifact@v7
with:
name: dart-package-assembled
path: packages/dart
if-no-files-found: error
retention-days: 7
# Swift Package Index has no central registry — packages are consumed
# directly from git tags, so the tag push IS the publish event. The
# previous `check-spi-swift` + `publish-swift` jobs only pinged SPI for
# fast re-indexing (SPI auto-discovers within ~1h without a ping), so
# they have been dropped to cut runner cost. The `release_swift` output
# from `prepare` is still emitted but no longer consumed.
#
# Zig is similarly tag-based, but the publish-zig job is retained because
# it appends the tarball URL + SHA-256 to the release notes so consumers
# can copy-paste straight into `build.zig.zon`.
assemble-zig-package:
name: Assemble Zig package with prebuilt FFI libraries
needs: [prepare, check-c-ffi, c-ffi-libraries]
if: ${{ needs.prepare.outputs.release_zig == 'true' && (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.ref }}
fetch-depth: 0
submodules: recursive
- uses: actions/download-artifact@v8
with:
pattern: c-ffi-*
path: c-ffi-artifacts
merge-multiple: true
- name: Stage prebuilt FFI libraries into Zig package
# Inline: alef zig codegen produces packages/zig/ with include/ (C headers
# from the zig backend). This step populates lib/<rid>/ with the prebuilt
# C FFI shared libraries for each platform so the tarball is complete.
# Platform naming follows alef's Go platform convention: linux-x64,
# linux-arm64, darwin-x64, darwin-arm64, windows-x64, windows-arm64.
shell: bash
run: |
mkdir -p packages/zig/lib
# Map alef's platform names to the directories produced by c-ffi-libraries job.
# c-ffi-libraries matrix produces: c-ffi-{platform}/ where platform is
# linux-x64, linux-arm64, darwin-x64, darwin-arm64, windows-x64, windows-arm64.
declare -A platform_map=(
[linux-x64]="linux-x64"
[linux-arm64]="linux-arm64"
[darwin-x64]="darwin-x64"
[darwin-arm64]="darwin-arm64"
[windows-x64]="windows-x64"
[windows-arm64]="windows-arm64"
)
for alef_rid in "${!platform_map[@]}"; do
artifact_platform="${platform_map[$alef_rid]}"
src_dir="c-ffi-artifacts/${artifact_platform}"
# c-ffi-libraries produces a flat distribution directory per platform
# containing the FFI shared library (.so/.dylib/.dll). Find and copy.
if [[ -d "$src_dir" ]]; then
mkdir -p "packages/zig/lib/${alef_rid}"
# Copy all shared library artifacts (.so, .dylib, .dll) from the distribution
find "$src_dir" -maxdepth 2 -type f \( -name '*.so' -o -name '*.dylib' -o -name '*.dll' \) \
-exec cp {} "packages/zig/lib/${alef_rid}/" \;
echo "Staged FFI libraries for $alef_rid:"
ls -la "packages/zig/lib/${alef_rid}/"
else
echo "Warning: no C FFI artifact found for $alef_rid at $src_dir"
fi
done
- name: Create Zig package tarball
# Inline: archive packages/zig with the populated lib/ subdirectories.
# alef zig backend has already generated the source code, build files,
# and C headers. This step tarballs the complete package.
shell: bash
run: |
cd packages/zig
tar -czf "../../html-to-markdown-rs-zig-v${{ needs.prepare.outputs.version }}.tar.gz" .
- uses: actions/upload-artifact@v7
with:
name: zig-package-assembled
path: html-to-markdown-rs-zig-v${{ needs.prepare.outputs.version }}.tar.gz
if-no-files-found: error
retention-days: 7
check-zig:
name: Check Zig package presence
needs: prepare
if: ${{ (needs.prepare.outputs.is_tag == 'true' || needs.prepare.outputs.dry_run == 'true') && needs.prepare.outputs.release_zig == 'true' }}
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.check.outputs.exists }}
steps:
- id: check
# `registry: github-release` (not `registry: zig`) — alef check-registry's
# zig path only verifies the release tag exists. On a real release that's
# always true, so it short-circuits `publish-zig` to skipped (regression:
# v3.5.1 shipped without the zig tarball asset because of this). Verify
# the actual asset is present instead.
uses: xberg-io/actions/check-registry@v1
with:
registry: github-release
package: html-to-markdown-rs-zig-v${{ needs.prepare.outputs.version }}.tar.gz
version: ${{ needs.prepare.outputs.version }}
repo: ${{ github.repository }}
assets: html-to-markdown-rs-zig-v${{ needs.prepare.outputs.version }}.tar.gz
# ─── Build matrix jobs ────────────────────────────────────────────────
python-wheels:
name: Build Python wheels (${{ matrix.os }})
needs: [prepare, check-pypi]
if: ${{ needs.prepare.outputs.release_python == 'true' && (needs.check-pypi.outputs.exists != 'true' || needs.prepare.outputs.force_republish == 'true') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 180
env:
# Required by cibuildwheel/delocate: the Rust-compiled .so/.dylib targets
# macOS 10.12+ (default in modern toolchains). 10.9 was the legacy default
# which causes delocate to refuse to relocate the wheel.
MACOSX_DEPLOYMENT_TARGET: "10.12"
strategy:
fail-fast: false
matrix:
# windows-11-arm: cibuildwheel does not yet support aarch64-pc-windows-msvc target
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-latest, macos-15-intel]
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.checkout_ref }}
fetch-depth: 0
submodules: recursive
- name: Free disk space
if: runner.os == 'Linux'
uses: xberg-io/actions/free-disk-space-linux@v1
- name: Setup Rust on host (macOS, Windows)
# cibuildwheel's before-build runs `cargo build` which auto-installs
# the toolchain pinned by rust-toolchain.toml via rustup. On macOS-arm64
# this collides with the runner's pre-installed clippy/rustfmt and
# rustup aborts with "detected conflict: bin/cargo-clippy". Pre-install
# via actions-rust-lang/setup-rust-toolchain so the toolchain is ready
# by the time cibuildwheel runs cargo. No-op for Linux (cibw runs in
# a manylinux container — host rust is invisible there).
if: runner.os != 'Linux'
uses: xberg-io/actions/setup-rust@v1
with:
use-sccache: "false"
- name: Build wheels
uses: xberg-io/actions/build-python-wheels@v1
with:
python-version: "3.13"
package-dir: packages/python
# abi3-py310 is enabled in pyo3 features → one wheel per platform covers 3.10+.
# Without this override, cibuildwheel rebuilds for cp310/cp311/cp312/cp313/cp314 = 5x duplicates.
cibw-build: "cp310-*"
cibw-before-build-linux: >
yum install -y openssl-devel &&
(test -x /usr/bin/aarch64-linux-gnu-gcc ||
ln -sf "$(command -v gcc)" /usr/local/bin/aarch64-linux-gnu-gcc 2>/dev/null || true) &&
pip install maturin uv &&
source ~/.cargo/env &&
python scripts/prepare_wheel.py
cibw-before-build-macos: >
pip install maturin uv &&
source ~/.cargo/env &&
python scripts/prepare_wheel.py
cibw-before-build-windows: >
pip install maturin uv &&
set PATH=%USERPROFILE%\.cargo\bin;%PATH% &&
python scripts\prepare_wheel.py
upload-artifact: "false"
- uses: actions/upload-artifact@v7
with:
name: python-wheels-${{ matrix.os }}
path: wheelhouse/*.whl
retention-days: 14
python-sdist:
name: Build Python sdist
needs: [prepare, check-pypi, publish-crates]
if: ${{ !cancelled() && needs.publish-crates.result != 'failure' && needs.prepare.outputs.release_python == 'true' && (needs.check-pypi.outputs.exists != 'true' || needs.prepare.outputs.force_republish == 'true') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.checkout_ref }}
fetch-depth: 0
submodules: recursive
- uses: xberg-io/actions/setup-rust@v1
- uses: actions/setup-python@v6.2.0
with:
python-version: "3.13"
- name: Build and bundle CLI binary
# The CLI binary is bundled into the sdist so it can be installed via pipx.
shell: bash
run: |
cargo build --release --locked --package html-to-markdown-cli
mkdir -p packages/python/html_to_markdown/_cli
cp target/release/html-to-markdown packages/python/html_to_markdown/_cli/ 2>/dev/null \
|| cp target/release/html-to-markdown.exe packages/python/html_to_markdown/_cli/
- uses: xberg-io/actions/build-python-sdist@v1
with:
package-dir: packages/python
output-dir: dist
- uses: actions/upload-artifact@v7
with:
name: python-sdist
path: dist/*.tar.gz
retention-days: 14
node-typescript-defs:
name: Generate Node TypeScript definitions
needs: [prepare, check-npm]
if: ${{ needs.prepare.outputs.release_node == 'true' && (needs.check-npm.outputs.node_exists != 'true' || needs.prepare.outputs.force_republish == 'true') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.checkout_ref }}
fetch-depth: 0
submodules: recursive
- uses: xberg-io/actions/setup-rust@v1
- uses: xberg-io/actions/setup-node-workspace@v1
with:
node-version: "24"
- name: Generate TypeScript definitions
# Inline: napi build produces index.js + a fresh index.d.ts as a side
# effect. We keep napi's index.js (its platform-dispatch stub loader)
# but restore alef's committed index.d.ts: alef adds *Update DTO types
# (e.g. ConversionOptionsUpdate, PreprocessingOptionsUpdate) that the
# napi macros deliberately filter out — those types are committed in
# crates/html-to-markdown-node/index.d.ts.
shell: bash
run: |
pnpm --filter ./crates/html-to-markdown-node exec napi build --release
git checkout HEAD -- crates/html-to-markdown-node/index.d.ts
mkdir -p typescript-defs
cp crates/html-to-markdown-node/index.js crates/html-to-markdown-node/index.d.ts typescript-defs/
- uses: actions/upload-artifact@v7
with:
name: node-typescript-defs
path: typescript-defs/
retention-days: 14
node-bindings:
name: Build Node bindings (${{ matrix.target }})
needs: [prepare, check-npm]
if: ${{ needs.prepare.outputs.release_node == 'true' && (needs.check-npm.outputs.node_exists != 'true' || needs.prepare.outputs.force_republish == 'true') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
include:
- { os: macos-latest, target: aarch64-apple-darwin, rust_target: "", use_napi_cross: false }
- { os: macos-15-intel, target: x86_64-apple-darwin, rust_target: "", use_napi_cross: false }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, rust_target: "", use_napi_cross: false }
- {
os: ubuntu-latest,
target: aarch64-unknown-linux-gnu,
rust_target: aarch64-unknown-linux-gnu,
use_napi_cross: true,
}
# musl + armv7 deferred — napi-cross artifact path mismatch ("No dist dir found") blocks every cross-compiled binding.
- { os: windows-latest, target: x86_64-pc-windows-msvc, rust_target: "", use_napi_cross: false }
- {
os: windows-latest,
target: aarch64-pc-windows-msvc,
rust_target: aarch64-pc-windows-msvc,
use_napi_cross: false,
}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.checkout_ref }}
fetch-depth: 0
submodules: recursive
- name: Free disk space
if: runner.os == 'Linux'
uses: xberg-io/actions/free-disk-space-linux@v1
- uses: xberg-io/actions/setup-rust@v1
with:
target: ${{ matrix.rust_target || matrix.target }}
cache-key-prefix: publish-node-${{ matrix.target }}
- uses: xberg-io/actions/setup-node-workspace@v1
with:
node-version: "24"
- name: Build native module
uses: xberg-io/actions/build-node-napi@v1
with:
crate-dir: crates/html-to-markdown-node
target: ${{ matrix.target }}
use-napi-cross: ${{ matrix.use_napi_cross }}
pack-target-tarball: node-bindings-${{ matrix.target }}.tar.gz
# setup-node-workspace already ran `pnpm install --no-frozen-lockfile`.
# Skip build-node-napi's own install: under pnpm 11.8.0 its plain
# `pnpm install --filter` re-enforces CI frozen-lockfile and fails on
# the napi platform optionalDependencies (pinned to the not-yet-published
# release version, so they can't be in the lockfile). pnpm 11.6.0 treated
# it as a no-op; 11.8.0 does not.
install-deps: "false"
- uses: actions/upload-artifact@v7
with:
name: node-bindings-${{ matrix.target }}
path: node-bindings-${{ matrix.target }}.tar.gz
retention-days: 14
wasm-bindings:
name: Build WASM package
needs: [prepare, check-wasm]
if: ${{ needs.prepare.outputs.release_wasm == 'true' && (needs.check-wasm.outputs.exists != 'true' || needs.prepare.outputs.force_republish == 'true') }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.checkout_ref }}
fetch-depth: 0
submodules: recursive
- uses: xberg-io/actions/setup-rust@v1
with:
target: wasm32-unknown-unknown
cache-key-prefix: publish-wasm
- uses: xberg-io/actions/setup-node-workspace@v1
with:
node-version: "24"
- uses: xberg-io/actions/build-wasm-package@v1
with:
crate-dir: crates/html-to-markdown-wasm
pack-tarball: "false"
- uses: actions/upload-artifact@v7
with:
name: wasm-bundle
path: |
crates/html-to-markdown-wasm/dist/**
crates/html-to-markdown-wasm/dist-node/**
crates/html-to-markdown-wasm/dist-web/**
crates/html-to-markdown-wasm/pkg/**
crates/html-to-markdown-wasm/package.json
retention-days: 14
ruby-gem:
name: Build Ruby gem (${{ matrix.label }})
needs: [prepare, check-rubygems, publish-crates]
if: ${{ !cancelled() && needs.publish-crates.result != 'failure' && needs.prepare.outputs.release_ruby == 'true' && (needs.check-rubygems.outputs.exists != 'true' || needs.prepare.outputs.force_republish == 'true') }}
runs-on: ${{ matrix.os }}
timeout-minutes: 180
env:
RB_SYS_CARGO_PROFILE: release
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, label: linux }
- { os: ubuntu-24.04-arm, label: linux-aarch64 }
- { os: macos-latest, label: macos-arm64 }
- { os: macos-15-intel, label: macos-x86_64 }
- { os: ubuntu-latest, label: windows-x64, dock_platform: x64-mingw-ucrt }
# windows-11-arm: deferred until rb-sys + Magnus toolchain validated on aarch64-pc-windows-msvc
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.checkout_ref }}
fetch-depth: 0
submodules: recursive
- name: Free disk space
if: runner.os == 'Linux'
uses: xberg-io/actions/free-disk-space-linux@v1
- name: Drop cached CLI binaries
# Inline: stale CLI artifacts under packages/ruby/exe/ confuse rake
# build's filtering. One-shot cleanup, no shared action equivalent.
shell: bash
run: rm -rf packages/ruby/exe/* packages/ruby/pkg
- name: Install MSYS2 toolchain (Windows)
if: runner.os == 'Windows'
# Inline: rb-sys requires the MSYS2 toolchain on Windows for clang +
# libffi headers. Magnus also needs ucrt64-prefixed binaries on PATH.
shell: pwsh
run: |
ridk install 1 2 3
$msys2Path = (ridk version).Split("`n") | Where-Object { $_ -match "msys2:" } | ForEach-Object { ($_ -split ":\s*")[1].Trim() }
if (-not $msys2Path) { $msys2Path = "C:\msys64" }
ridk exec pacman -S --noconfirm --needed mingw-w64-ucrt-x86_64-clang mingw-w64-ucrt-x86_64-libffi
"$msys2Path\ucrt64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Rust (GNU on Windows)
if: runner.os == 'Windows'
# Inline: rb-sys/Magnus only build against the GNU ABI on Windows; the
# default MSVC toolchain produces incompatible artifacts.
shell: pwsh
run: |
rustup install stable-x86_64-pc-windows-gnu
rustup default stable-x86_64-pc-windows-gnu
rustup target add x86_64-pc-windows-gnu
rustc --version
- name: Configure bindgen sysroot (Windows)
if: runner.os == 'Windows'
# Inline: bindgen needs an explicit libclang sysroot pointing at the
# MSYS2 ucrt64 install — discovery fails on the GitHub runner image.
shell: bash
run: |
UCRT="/c/msys64/ucrt64"
echo "BINDGEN_EXTRA_CLANG_ARGS=--sysroot=${UCRT} -I${UCRT}/include" >>"$GITHUB_ENV"
echo "LIBCLANG_PATH=${UCRT}/bin" >>"$GITHUB_ENV"
- uses: xberg-io/actions/setup-rust@v1
if: runner.os != 'Windows'
with:
cache-key-prefix: publish-ruby-${{ matrix.label }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler: "4.0.3"
bundler-cache: false
- name: Install Ruby dependencies
# Inline: bundle config + install in the package dir; trivially small
# and identical across crawlberg/xberg/html-to-markdown.
shell: bash
working-directory: packages/ruby
run: |
gem install bundler -v 4.0.3
bundle config set --local path 'vendor/bundle'
bundle install --jobs 4 --retry 3
- uses: xberg-io/actions/build-ruby-gem@v1
if: matrix.dock_platform == ''
with:
package-dir: packages/ruby
- name: Build platform gem
# Inline: each matrix runner builds the gem for its own native platform
# via `rake compile && rake build`. rake-compiler's compile step sets
# the gem's native platform tag from rb_config, so the produced gem is
# already platform-tagged (e.g. xberg-X.Y.Z-x86_64-linux.gem). This
# mirrors the Xberg sibling's proven Ruby publish path. For Windows
# we cross-compile inside rb-sys-dock so the GNU toolchain produces a
# x64-mingw-ucrt gem from the linux runner.
shell: bash
run: |
if [ -n "${{ matrix.dock_platform }}" ]; then
# Cross-compile for Windows via Docker using rb-sys-dock.
# The rb-sys-dock container ships its own Ruby toolchain; bundler
# must `install` inside the container before `exec rake` so the
# lockfile materializes against the container's Ruby version
# rather than the host's.
# Pin gem below 0.9.128 to get the 0.9.127 container, then exclude
# Ruby 4.0.2 via RUBY_CC_VERSION — both 0.9.127 and 0.9.128 ship
# Ruby 4.0.2 whose <ruby/defines.h> pulls <sys/select.h>, which
# clang cannot resolve in the mingw cross sysroot. 0.9.127's
# container also ships 3.1.7/3.2.11/3.3.11/3.4.9; pin to those.
#
# Run rb-sys-dock from the WORKSPACE ROOT so the container mounts
# the whole repo — the gem's Cargo.toml has a path-dep
# `html-to-markdown-rs = { path = "../../../../../crates/html-to-markdown" }`
# which resolves outside `packages/ruby/` and would not exist in
# a container mounted at the gem dir. Use `--directory packages/ruby`
# so the container's working dir is still the gem root.