Merge pull request #295 from styx-api/dependabot/github_actions/actio… #66
Workflow file for this run
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: Publish to GitHub Pages (includes Hub sources) | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| # 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: | |
| build-and-deploy: | |
| name: Build and Deploy to GitHub Pages | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| registry-url: https://registry.npmjs.org | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v6 | |
| - name: Styx compile | |
| run: | | |
| uv --directory tooling run wrap build jsonschema typescript python | |
| - name: Build npm package | |
| run: | | |
| cd dist/niwrap-js | |
| npm install | |
| npm run build | |
| - name: Prepare GitHub Pages content | |
| run: | | |
| # Create a temporary directory for GitHub Pages content | |
| mkdir -p _site | |
| # Copy the source directories to the Pages site | |
| if [ -d "src" ]; then | |
| cp -r src _site/source | |
| else | |
| echo "Warning: src directory not found" | |
| exit 1 | |
| fi | |
| if [ -d "dist/niwrap-json-schema" ]; then | |
| cp -r dist/niwrap-json-schema _site/ | |
| else | |
| echo "Warning: dist/niwrap-json-schema directory not found" | |
| exit 1 | |
| fi | |
| # Copy the built JavaScript package dist folder to the Pages site | |
| if [ -d "dist/niwrap-js/dist" ]; then | |
| cp -r dist/niwrap-js/dist _site/js | |
| else | |
| echo "Warning: dist/niwrap-js/dist directory not found" | |
| exit 1 | |
| fi | |
| # Copy the built Python symbolmaps to the Pages site | |
| if [ -d "dist/niwrap-python/symbolmaps" ]; then | |
| cp -r dist/niwrap-python/symbolmaps _site/python-symbolmaps | |
| else | |
| echo "Warning: dist/niwrap-python/symbolmaps directory not found" | |
| exit 1 | |
| fi | |
| # Create index.html that redirects to the repository | |
| cat > _site/index.html << 'EOF' | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="refresh" content="0; url=https://github.com/${{ github.repository }}"> | |
| <link rel="canonical" href="https://github.com/${{ github.repository }}"> | |
| <title>Redirecting to Repository</title> | |
| </head> | |
| <body> | |
| <p>Redirecting to <a href="https://github.com/${{ github.repository }}">repository</a>...</p> | |
| <script> | |
| window.location.href = "https://github.com/${{ github.repository }}"; | |
| </script> | |
| </body> | |
| </html> | |
| EOF | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: _site | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |