1+ # Copyright (c) Microsoft Corporation.
2+ # Licensed under the MIT License.
3+
4+ name : Deploy Regorus Playground
5+
6+ on :
7+ push :
8+ branches : [ playground ]
9+ paths :
10+ - ' docs/playground/**'
11+ - ' bindings/wasm/**'
12+ - ' scripts/build-playground.sh'
13+ - ' .github/workflows/deploy-playground.yml'
14+ workflow_dispatch :
15+
16+ jobs :
17+ build-and-deploy :
18+ runs-on : ubuntu-latest
19+
20+ steps :
21+ - name : Checkout Source Repository
22+ uses : actions/checkout@v4
23+ with :
24+ fetch-depth : 0
25+
26+ - name : Setup Rust
27+ uses : actions-rs/toolchain@v1
28+ with :
29+ toolchain : stable
30+ target : wasm32-unknown-unknown
31+ override : true
32+
33+ - name : Install wasm-pack
34+ run : curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
35+
36+ - name : Cache Rust dependencies
37+ uses : actions/cache@v3
38+ with :
39+ path : |
40+ ~/.cargo/bin/
41+ ~/.cargo/registry/index/
42+ ~/.cargo/registry/cache/
43+ ~/.cargo/git/db/
44+ target/
45+ key : ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }}
46+
47+ - name : Build Playground
48+ run : |
49+ chmod +x scripts/build-playground.sh
50+ ./scripts/build-playground.sh
51+
52+ - name : Prepare deployment files
53+ run : |
54+ # Copy built playground to deployment directory
55+ mkdir -p deploy
56+ cp -r build-playground/* deploy/
57+
58+ # Create .nojekyll to ensure GitHub Pages serves all files
59+ touch deploy/.nojekyll
60+
61+ # Create README for deployment repository
62+ cat > deploy/README.md << 'EOF'
63+ # Regorus Playground
64+
65+ Interactive Regorus Playground - A web-based environment for experimenting with Rego policies.
66+
67+ **🚀 [Launch Playground](https://anakrish.github.io/regorus-playground/)**
68+
69+ ## Features
70+
71+ - 20+ example policies across multiple domains
72+ - Real-time policy evaluation with coverage visualization
73+ - Multiple layout options (split, tabs, full-screen)
74+ - Syntax highlighting and Monaco Editor integration
75+ - WASM-powered Regorus engine
76+
77+ ## About
78+
79+ This playground is automatically deployed from the [Regorus](https://github.com/anakrish/regorus) repository.
80+
81+ - **Source**: [regorus/docs/playground](https://github.com/anakrish/regorus/tree/playground/docs/playground)
82+ - **Engine**: [Regorus Rust Library](https://github.com/anakrish/regorus)
83+ - **Last Updated**: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
84+ - **Commit**: ${{ github.sha }}
85+ EOF
86+
87+ - name : Deploy to regorus-playground repository
88+ uses : peaceiris/actions-gh-pages@v3
89+ with :
90+ # Use a personal token to push to different repository
91+ personal_token : ${{ secrets.PLAYGROUND_DEPLOY_TOKEN }}
92+ external_repository : anakrish/regorus-playground
93+ publish_dir : ./deploy
94+ publish_branch : main
95+ force_orphan : true
96+ commit_message : ' Deploy playground from regorus@${{ github.sha }}'
97+
98+ - name : Output deployment info
99+ run : |
100+ echo "🚀 Playground deployed successfully!"
101+ echo "📍 URL: https://anakrish.github.io/regorus-playground/"
102+ echo "📝 Commit: ${{ github.sha }}"
0 commit comments