{"id":29642195,"url":"https://github.com/na1307/blazor-github-pages","last_synced_at":"2025-07-21T22:07:45.403Z","repository":{"id":236416851,"uuid":"792567964","full_name":"na1307/blazor-github-pages","owner":"na1307","description":"Prepare Blazor WASM for GitHub Pages","archived":false,"fork":false,"pushed_at":"2025-02-07T18:12:44.000Z","size":722,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T19:20:34.951Z","etag":null,"topics":["blazor","blazor-wasm","blazor-webassembly","github-pages","github-pages-deployment"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/na1307.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-04-27T00:26:30.000Z","updated_at":"2025-02-07T18:12:47.000Z","dependencies_parsed_at":"2024-12-20T16:28:14.541Z","dependency_job_id":"86be3101-52cc-4ab8-85bb-40c68b787c66","html_url":"https://github.com/na1307/blazor-github-pages","commit_stats":null,"previous_names":["na1307/blazor-github-pages"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/na1307/blazor-github-pages","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na1307%2Fblazor-github-pages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na1307%2Fblazor-github-pages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na1307%2Fblazor-github-pages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na1307%2Fblazor-github-pages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/na1307","download_url":"https://codeload.github.com/na1307/blazor-github-pages/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na1307%2Fblazor-github-pages/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266388048,"owners_count":23921386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blazor","blazor-wasm","blazor-webassembly","github-pages","github-pages-deployment"],"created_at":"2025-07-21T22:07:44.722Z","updated_at":"2025-07-21T22:07:45.390Z","avatar_url":"https://github.com/na1307.png","language":"TypeScript","readme":"# GitHub Pages Blazor WASM\n\nThis action allows you to deploy your Blazor WASM app to GitHub Pages.\n\n## Table of Contents\n- [GitHub Pages Blazor WASM](#github-pages-blazor-wasm)\n  - [Table of Contents](#table-of-contents)\n  - [What this does](#what-this-does)\n  - [How to use](#how-to-use)\n    - [1. Set the Project](#1-set-the-project)\n    - [2. Set the repository settings](#2-set-the-repository-settings)\n    - [3. Add workflow file](#3-add-workflow-file)\n  - [Inputs and Outputs](#inputs-and-outputs)\n    - [Inputs](#inputs)\n    - [Outputs](#outputs)\n  - [Troubleshooting](#troubleshooting)\n    - [Common Issues](#common-issues)\n\n## What this does\n\nRestore, build, and publish the project, modify index.html and 404.html to fit the repository.\n\n## How to use\n\n### 1. Set the Project\n\nAdd [`Bluehill.Blazor.GHPages` NuGet Package](https://www.nuget.org/packages/Bluehill.Blazor.GHPages/) to the project.\nThis Package adds `gh-pages.js` and `404.html` to the published `wwwroot` directory. If these files already exist,\ndelete them.\n\nModify `index.html` to include the `gh-pages.js` script. This script adjusts routing for Blazor WebAssembly apps\ndeployed to GitHub Pages, ensuring the app behaves correctly when navigating subpages.\n\n```html\n\u003cscript src=\"gh-pages.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"_framework/blazor.webassembly.js\"\u003e\u003c/script\u003e\n```\n\n### 2. Set the repository settings\n\nGo to your repository's **Settings \u003e Pages \u003e Source** and set the source to **GitHub Actions**.\n\nThis step is crucial for enabling deployments using the GitHub Pages workflow. For reference:\n\n![image1](./image1.png)\n\n### 3. Add workflow file\n\nBelow is an example workflow that deploys your Blazor WebAssembly app to GitHub Pages. Copy these into\n`.github/workflows/gh-pages.yml` in your repository.\n\n\u003e **Replace `MyBlazorApp/MyBlazorApp.csproj` with your actual `.csproj` path.**\n\n```yml\nname: Deploy GitHub Pages\n\non:\n  # Runs on pushes targeting the default branch\n  push:\n    branches: [ \"main\" ]\n\n  # Allows you to run this workflow manually from the Actions tab\n  workflow_dispatch:\n\n# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages\npermissions:\n  contents: read\n  pages: write\n  id-token: write\n\n# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.\n# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.\nconcurrency:\n  group: \"pages\"\n  cancel-in-progress: false\n\njobs:\n  # Build job\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Setup .NET\n        uses: actions/setup-dotnet@v4\n        with:\n          dotnet-version: 9.0.x\n      - name: Prepare Blazor WASM for GitHub Pages\n        uses: na1307/blazor-github-pages@v3\n        id: prepare\n        with:\n          project-path: MyBlazorApp/MyBlazorApp.csproj\n      - name: Setup Pages\n        uses: actions/configure-pages@v5\n      - name: Upload artifact\n        uses: actions/upload-pages-artifact@v3\n        with:\n          path: ${{ steps.prepare.outputs.wwwroot-path }}\n\n  # Deployment job\n  deploy:\n    environment:\n      name: github-pages\n      url: ${{ steps.deployment.outputs.page_url }}\n    runs-on: ubuntu-latest\n    needs: build\n    steps:\n      - name: Deploy to GitHub Pages\n        id: deployment\n        uses: actions/deploy-pages@v4\n```\n\n## Inputs and Outputs\n\nThis action has two inputs and one output.\n\n### Inputs\n\n`project-path`: Path of project (.csproj). Required, no default value. For example: `MyBlazorApp/MyBlazorApp.csproj`.\n\n`publish-path`: Path to output in the Publish step. Most of the time, you can leave this as the default `_out`. However,\nyou can specify a custom path if needed for your project structure or workflow requirements.\n\n\u003e **Note:** Inputs `main-repo` and `fix-404` have been **deprecated** as of version v3.\n\u003e This action now:\n\u003e - Automatically detects if the repository is the default Pages repository (username.github.io).\n\u003e - Modifies `404.html` if it exists.\n\n### Outputs\n\n`wwwroot-path`: The resulting `wwwroot` path. It must be passed to `path` in the `upload-pages-artifact` action.\n\n## Troubleshooting\n\n### Common Issues\n\n1. **`wwwroot` Path Not Found**\n    - Ensure the Blazor project builds and publishes successfully.\n    - Verify that the `publish-path` input matches the expected output directory.\n\n2. **Deployment Fails**\n    - Ensure that your repository’s Pages Source is set to **GitHub Actions**.\n    - Check the logs in the **Deploy to GitHub Pages** step for detailed error messages.\n\n3. **Routing Issues**\n    - Confirm that `gh-pages.js` is included in `index.html` as shown in [Step 1](#1-set-the-project).\n\nFor additional support, file an issue in the [GitHub repository](https://github.com/na1307/blazor-github-pages).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fna1307%2Fblazor-github-pages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fna1307%2Fblazor-github-pages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fna1307%2Fblazor-github-pages/lists"}