diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..95cfc7a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,99 @@ +name: Publish Schemas + +on: + # Trigger the workflow every time you push to the `main` branch + push: + branches: [ main ] + +# Every run step in this workflow will use Bash as the default shell +defaults: + run: + shell: bash + +# Allow this job to clone the repo and create a page deployment +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + process-schemas: + name: Process Schemas + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: 'recursive' + - name: Install just + uses: extractions/setup-just@v2 + - name: Process directories + run: | + # List of directories to process + directories=("tbdex") + + # Function to check if a directory is a submodule + is_submodule() { + local dir="$1" + if [ -f .gitmodules ] && git config --file .gitmodules --get "submodule.$dir.path" &> /dev/null; then + return 0 + else + return 1 + fi + } + + # Process each directory + for dir in "${directories[@]}"; do + echo "Processing $dir" + if [ -d "$dir" ]; then + # Create the corresponding directory in hosted/ + mkdir -p "hosted/$dir" + + if is_submodule "$dir"; then + echo "$dir is a submodule" + ( + cd "$dir" + just schemas + if [ -d ".schemas" ]; then + cp -R .schemas/* "../hosted/$dir/" + else + echo "Error: .schemas directory not found in $dir after running 'just schemas'" + exit 1 # This will cause the workflow to fail + fi + ) + else + echo "$dir is not a submodule" + cp -R "$dir"/* "hosted/$dir/" + fi + else + echo "Error: $dir does not exist" + exit 1 # This will cause the workflow to fail + fi + done + + - name: List contents of hosted directory + run: ls -R hosted + + - name: Upload hosted directory + uses: actions/upload-pages-artifact@v3 + with: + path: hosted + + deploy: + needs: process-schemas + name: Deploy + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6182ed0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Ignore everything in the hosted directory except the index.html file +/hosted/* +!/hosted/index.html \ No newline at end of file diff --git a/hosted/index.html b/hosted/index.html new file mode 100644 index 0000000..e3c08ef --- /dev/null +++ b/hosted/index.html @@ -0,0 +1,10 @@ + + + + + + Hosted Schemas + + + + \ No newline at end of file diff --git a/kcc b/kcc index 6c4ce77..f3a1089 160000 --- a/kcc +++ b/kcc @@ -1 +1 @@ -Subproject commit 6c4ce77a691ded6ec24d3d9e4214ab5d3c6bed04 +Subproject commit f3a1089d090d441f61e9212179aeef181ea4f6b0 diff --git a/tbdex b/tbdex index b37078a..f7260d8 160000 --- a/tbdex +++ b/tbdex @@ -1 +1 @@ -Subproject commit b37078ac570fa48034667169bc545807e10921ed +Subproject commit f7260d8ba54a7cf142ad8d28c76207ffc0a3d1e6