{"id":25184004,"url":"https://github.com/anorcle/next-pages","last_synced_at":"2025-10-24T16:31:34.411Z","repository":{"id":42984447,"uuid":"412749194","full_name":"anorcle/next-pages","owner":"anorcle","description":"By default, next export will generate an out directory, which can be served by any static hosting service or CDN like GitHub Pages. But the name of inner directories (like _next/) and chunk files start with underscore and GitHub Pages return 404 for such files. Next Pages automatically rename those files and folders, remove the beginning underscore and replace the new URL in your source code. Also, Next Pages rename your out directory to docs.","archived":false,"fork":false,"pushed_at":"2022-03-24T19:00:01.000Z","size":152,"stargazers_count":4,"open_issues_count":2,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-03-15T02:12:42.443Z","etag":null,"topics":["auto-deployment","automation","cd","ci","github-action","github-pages","next","nextjs","nextjs-example","react","reactjs","workflows"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/next-pages","language":"JavaScript","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/anorcle.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}},"created_at":"2021-10-02T09:23:48.000Z","updated_at":"2024-02-03T08:10:46.000Z","dependencies_parsed_at":"2023-01-11T17:22:20.161Z","dependency_job_id":null,"html_url":"https://github.com/anorcle/next-pages","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"0bc287a22ddbeddc10f49474ca6bcc9ee4b76e1c"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anorcle%2Fnext-pages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anorcle%2Fnext-pages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anorcle%2Fnext-pages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anorcle%2Fnext-pages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anorcle","download_url":"https://codeload.github.com/anorcle/next-pages/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238004415,"owners_count":19400549,"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","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":["auto-deployment","automation","cd","ci","github-action","github-pages","next","nextjs","nextjs-example","react","reactjs","workflows"],"created_at":"2025-02-09T19:19:52.936Z","updated_at":"2025-10-24T16:31:33.975Z","avatar_url":"https://github.com/anorcle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Build and Deploy Next.js App to GitHub Pages\n\nUse this workflow in your Next Project to build and deploy your static sites on Github\n\n## Introduction\nBy default, ```next export``` will generate an ```out``` directory, which can be served by any static hosting service or CDN like GitHub Pages. But the name of inner directories (like ```_next/```) and chunk files start with *underscore* and GitHub Pages return ```404``` for such files. **Next Pages** automatically rename those files and folders, remove the beginning *underscore* and replace the new URL in your source code. Also, **Next Pages** rename your ```out``` directory to ```docs```.\n\n## Setup GitHub Pages\n![image](https://user-images.githubusercontent.com/44930179/135717105-2b70de01-8d30-41b3-8d69-f7827b8289f6.png)\n\n## Build Command\n\nUpdate the build command of your ```package.json``` as shown below.\n\n```json\n{\n  \"scripts\": {\n    \"build\": \"next build \u0026\u0026 next export\"\n  }\n}\n```\n\n```npm run build``` could be used to build and export static pages.\n\n## Create GitHub Action\n\nCreate ```build.yml``` file in ```.github/workflows/``` folder.\n\nExample:\n```bash\n└──.github\n    └── workflows\n        └── build.yml\n```\n\nInclude the following steps in the end of a build job.\n```yml\n- name: Next Pages\n  uses: anorcle/next-pages@v1.0\n- name: Commit and push changes\n  run: |\n    git config --global user.name \"anorcle\"\n    git config --global user.email \"next-pages@anorcle.com\"\n    git add -A\n    git commit -m \"New Build\"\n    git push\n```\nYou can replace your *username* and *email* for above ```git commit```.\n\n\n# Example\n\n### Sample package.json\n\n\n```json\n{\n  \"name\": \"my-next-pages\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"next dev\",\n    \"build\": \"next build \u0026\u0026 next export\",\n    \"start\": \"next start\",\n    \"lint\": \"next lint\"\n  },\n  \"dependencies\": {\n    \"next\": \"11.1.2\",\n    \"react\": \"17.0.2\",\n    \"react-dom\": \"17.0.2\"\n  },\n  \"devDependencies\": {\n    \"eslint\": \"7.32.0\",\n    \"eslint-config-next\": \"11.1.2\"\n  }\n}\n```\n\n### Sample Github Workflow\n```yml\n# .github/workflows/build.yml\n\nname: Build, Export and Publish Next.js App\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\n  workflow_dispatch:\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-node@v2\n        with:\n          node-version: 14.x\n      - run: |\n          npm i\n          npm run build\n      - name: Next Pages\n        uses: anorcle/next-pages@v1.0\n      - name: Commit and push changes\n        run: |\n          git config --global user.name \"anorcle\"\n          git config --global user.email \"next-pages@anorcle.com\"\n          git add -A\n          git commit -m \"New Build\"\n          git push\n```\n\n### Sample Output\n![image](https://user-images.githubusercontent.com/44930179/135730924-58b070d6-0040-478e-9e24-c65a041aa22e.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanorcle%2Fnext-pages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanorcle%2Fnext-pages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanorcle%2Fnext-pages/lists"}