Optimize registry build process and bump OpenInverter to v0.4.5 #54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Publish ScriptO Registry | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| env: | |
| OUTPUT_DIR: dist | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Build index.json | |
| run: | | |
| python3 tools/build_index.py \ | |
| --scriptos-dir ScriptOs \ | |
| --apps-dir Apps \ | |
| --output ${{ env.OUTPUT_DIR }}/index.json \ | |
| --repo-url https://github.com/${{ github.repository }} \ | |
| --branch ${{ github.ref_name }} | |
| - name: Generate HTML catalogue | |
| run: | | |
| python3 tools/generate_catalogue.py \ | |
| --index ${{ env.OUTPUT_DIR }}/index.json \ | |
| --output ${{ env.OUTPUT_DIR }}/catalogue \ | |
| --scriptos-dir ScriptOs | |
| - name: Prepare gh-pages | |
| run: | | |
| if git fetch --depth=1 origin gh-pages; then | |
| git worktree add gh-pages gh-pages | |
| else | |
| echo "Creating gh-pages branch..." | |
| git worktree add --force gh-pages HEAD | |
| cd gh-pages | |
| git switch --orphan gh-pages | |
| git rm -rf . || true | |
| fi | |
| - name: Deploy to gh-pages | |
| run: | | |
| # Copy generated files to gh-pages | |
| cp -r ${{ env.OUTPUT_DIR }}/* gh-pages/ | |
| cd gh-pages | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "Update ScriptOs registry from ${{ github.sha }}" || exit 0 | |
| git push origin gh-pages | |
| - name: Output registry URL | |
| run: | | |
| REPO_OWNER=$(echo ${{ github.repository }} | cut -d'/' -f1) | |
| REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2) | |
| INDEX_URL="https://${REPO_OWNER}.github.io/${REPO_NAME}/index.json" | |
| CATALOGUE_URL="https://${REPO_OWNER}.github.io/${REPO_NAME}/catalogue/" | |
| echo "" | |
| echo "==========================================" | |
| echo "ScriptO Registry Published!" | |
| echo "==========================================" | |
| echo "" | |
| echo "Index URL: ${INDEX_URL}" | |
| echo "Catalogue URL: ${CATALOGUE_URL}" | |
| echo "" | |
| echo "Install ScriptO via URL:" | |
| echo " ?install=github:${REPO_OWNER}/${REPO_NAME}/ScriptOs/Name.py" | |
| echo "" | |