{"id":21412917,"url":"https://github.com/hunghg255/surge-preview","last_synced_at":"2025-07-14T02:32:42.774Z","repository":{"id":199836121,"uuid":"703857036","full_name":"hunghg255/surge-preview","owner":"hunghg255","description":"Deploy Static Site Project to Surge","archived":false,"fork":false,"pushed_at":"2024-09-20T17:35:35.000Z","size":912,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T23:01:43.189Z","etag":null,"topics":["actions","github","github-actions","react","surge","vue"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hunghg255.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-10-12T03:59:01.000Z","updated_at":"2025-01-07T14:42:29.000Z","dependencies_parsed_at":"2024-01-10T07:45:50.889Z","dependency_job_id":"135eae33-dcd8-457d-8419-67da74635652","html_url":"https://github.com/hunghg255/surge-preview","commit_stats":null,"previous_names":["hunghg255/surge-preview"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/hunghg255/surge-preview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunghg255%2Fsurge-preview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunghg255%2Fsurge-preview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunghg255%2Fsurge-preview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunghg255%2Fsurge-preview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hunghg255","download_url":"https://codeload.github.com/hunghg255/surge-preview/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunghg255%2Fsurge-preview/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265233753,"owners_count":23731825,"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":["actions","github","github-actions","react","surge","vue"],"created_at":"2024-11-22T18:16:12.005Z","updated_at":"2025-07-14T02:32:42.425Z","avatar_url":"https://github.com/hunghg255.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.npmjs.com/package/surge-preview\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n\u003cimg src=\"https://api.iconify.design/simple-icons:githubactions.svg?color=%23cefdb4\" alt=\"logo\" width='100'/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  A GitHub action that preview website in \u003ca href=\"https://surge.sh/\"\u003esurge.sh\u003c/a\u003e for your pull requests.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/hunghg255/surge-preview/graphs/contributors\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://img.shields.io/badge/all_contributors-1-orange.svg\" alt=\"Contributors\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/hunghg255/surge-preview/blob/main/LICENSE\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\u003cimg src=\"https://badgen.net/github/license/hunghg255/surge-preview\" alt=\"License\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Preview\n\n\u003cimg width=\"800\" alt=\"image\" src=\"./assets/deploying.png\"\u003e\n\n\u003cimg width=\"800\" alt=\"image\" src=\"./assets/success.png\"\u003e\n\n## Pros\n\nCompare to Netlify/Vercel?\n\n- It is **free**.\n- It supports multiple preview jobs.\n\n## Usage\n\nAdd a workflow (`.github/workflows/preview.yml`):\n\n```yaml\nname: 🔂 Preview Pull Request\n\non:\n  pull_request:\n    types:\n      - opened\n      - synchronize\n      - closed\n    branches:\n      - dev\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\njobs:\n  preview:\n    runs-on: ubuntu-latest\n    permissions:\n      pull-requests: write\n      contents: read\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          fetch-depth: 0\n\n      - uses: actions/setup-node@v3\n        with:\n          node-version: 18.x\n      - uses: hunghg255/surge-preview@master\n        id: preview_step\n        with:\n          surge_token: ${{ secrets.SURGE_TOKEN }}\n          github_token: ${{ secrets.GH_TOKEN }}\n          dist: dist\n          failOnError: true\n          build: |\n            npm install\n            npm run build\n      - name: Get the preview_url\n        run: echo \"url =\u003e ${{ steps.preview_step.outputs.preview_url }}\"\n```\n\nThe preview website url will be `https://{{repository.owner}}-{{repository.name}}-{{job.name}}-pr-{{pr.number}}.surge.sh`.\n\nThe preview website urls will be:\n\n- `https://{{repository.owner}}-{{repository.name}}-preview-job-1-pr-{{pr.number}}.surge.sh`\n- `https://{{repository.owner}}-{{repository.name}}-preview-job-2-pr-{{pr.number}}.surge.sh`\n\n## Teardown\n\nWhen a pull request is closed and teardown is set to 'true', then the surge instance will be destroyed.\n\n```yaml\nname: 🔂 Preview Pull Request\n\non:\n  pull_request:\n    types:\n      - opened\n      - synchronize\n      - closed\n    branches:\n      - dev\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\njobs:\n  preview:\n    runs-on: ubuntu-latest\n    permissions:\n      pull-requests: write\n      contents: read\n    steps:\n      - uses: actions/checkout@v3\n        with:\n          fetch-depth: 0\n\n      - uses: actions/setup-node@v3\n        with:\n          node-version: 18.x\n      - uses: hunghg255/surge-preview@master\n        id: preview_step\n        with:\n          surge_token: ${{ secrets.SURGE_TOKEN }}\n          github_token: ${{ secrets.GH_TOKEN }}\n          dist: dist\n          failOnError: true\n          teardown: 'true'\n          build: |\n            npm install\n            npm run build\n      - name: Get the preview_url\n        run: echo \"url =\u003e ${{ steps.preview_step.outputs.preview_url }}\"\n```\n\n## Inputs\n\n- `surge_token`: [Getting your Surge token](https://surge.sh/help/integrating-with-circleci).\n- `github_token`: Defaults: [`github.token`](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow). It is used to create Pull Request comment, so it requires the `pull-requests` permission set to `write` permission. Possible value: `secrets.GITHUB_TOKEN`.\n- `build`: build scripts to run before deploy.\n- `dist`: dist folder deployed to [surge.sh](https://surge.sh/).\n- `failOnError`: Set `failed` if a deployment throws error, defaults to `false`.\n- `teardown`: Determines if the preview instance will be torn down on PR close, defaults to `false`.\n- `preview_branch`: deploy to a branch, defaults to `false`.\n\n## Outputs\n\n- `preview_url`: The url for the related PR preview\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunghg255%2Fsurge-preview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhunghg255%2Fsurge-preview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunghg255%2Fsurge-preview/lists"}